@Generated(value="by gapic-generator-java") public class AssetServiceClient extends Object implements BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetAssetsHistoryRequest request =
BatchGetAssetsHistoryRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.addAllAssetNames(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setReadTimeWindow(TimeWindow.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
}
Note: close() needs to be called on the AssetServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of AssetServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AssetServiceSettings assetServiceSettings =
AssetServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AssetServiceSettings assetServiceSettings =
AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AssetServiceSettings assetServiceSettings =
AssetServiceSettings.newBuilder()
.setTransportChannelProvider(
AssetServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Modifier and Type | Class and Description |
---|---|
static class |
AssetServiceClient.ListAssetsFixedSizeCollection |
static class |
AssetServiceClient.ListAssetsPage |
static class |
AssetServiceClient.ListAssetsPagedResponse |
static class |
AssetServiceClient.ListSavedQueriesFixedSizeCollection |
static class |
AssetServiceClient.ListSavedQueriesPage |
static class |
AssetServiceClient.ListSavedQueriesPagedResponse |
static class |
AssetServiceClient.SearchAllIamPoliciesFixedSizeCollection |
static class |
AssetServiceClient.SearchAllIamPoliciesPage |
static class |
AssetServiceClient.SearchAllIamPoliciesPagedResponse |
static class |
AssetServiceClient.SearchAllResourcesFixedSizeCollection |
static class |
AssetServiceClient.SearchAllResourcesPage |
static class |
AssetServiceClient.SearchAllResourcesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
AssetServiceClient(AssetServiceSettings settings)
Constructs an instance of AssetServiceClient, using the given settings.
|
protected |
AssetServiceClient(AssetServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
AnalyzeIamPolicyResponse |
analyzeIamPolicy(AnalyzeIamPolicyRequest request)
Analyzes IAM policies to answer which identities have what accesses on which resources.
|
UnaryCallable<AnalyzeIamPolicyRequest,AnalyzeIamPolicyResponse> |
analyzeIamPolicyCallable()
Analyzes IAM policies to answer which identities have what accesses on which resources.
|
OperationFuture<AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata> |
analyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest request)
Analyzes IAM policies asynchronously to answer which identities have what accesses on which
resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination.
|
UnaryCallable<AnalyzeIamPolicyLongrunningRequest,Operation> |
analyzeIamPolicyLongrunningCallable()
Analyzes IAM policies asynchronously to answer which identities have what accesses on which
resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination.
|
OperationCallable<AnalyzeIamPolicyLongrunningRequest,AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata> |
analyzeIamPolicyLongrunningOperationCallable()
Analyzes IAM policies asynchronously to answer which identities have what accesses on which
resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination.
|
AnalyzeMoveResponse |
analyzeMove(AnalyzeMoveRequest request)
Analyze moving a resource to a specified destination without kicking off the actual move.
|
UnaryCallable<AnalyzeMoveRequest,AnalyzeMoveResponse> |
analyzeMoveCallable()
Analyze moving a resource to a specified destination without kicking off the actual move.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
BatchGetAssetsHistoryResponse |
batchGetAssetsHistory(BatchGetAssetsHistoryRequest request)
Batch gets the update history of assets that overlap a time window.
|
UnaryCallable<BatchGetAssetsHistoryRequest,BatchGetAssetsHistoryResponse> |
batchGetAssetsHistoryCallable()
Batch gets the update history of assets that overlap a time window.
|
BatchGetEffectiveIamPoliciesResponse |
batchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest request)
Gets effective IAM policies for a batch of resources.
|
UnaryCallable<BatchGetEffectiveIamPoliciesRequest,BatchGetEffectiveIamPoliciesResponse> |
batchGetEffectiveIamPoliciesCallable()
Gets effective IAM policies for a batch of resources.
|
void |
close() |
static AssetServiceClient |
create()
Constructs an instance of AssetServiceClient with default settings.
|
static AssetServiceClient |
create(AssetServiceSettings settings)
Constructs an instance of AssetServiceClient, using the given settings.
|
static AssetServiceClient |
create(AssetServiceStub stub)
Constructs an instance of AssetServiceClient, using the given stub for making calls.
|
Feed |
createFeed(CreateFeedRequest request)
Creates a feed in a parent project/folder/organization to listen to its asset updates.
|
Feed |
createFeed(String parent)
Creates a feed in a parent project/folder/organization to listen to its asset updates.
|
UnaryCallable<CreateFeedRequest,Feed> |
createFeedCallable()
Creates a feed in a parent project/folder/organization to listen to its asset updates.
|
SavedQuery |
createSavedQuery(CreateSavedQueryRequest request)
Creates a saved query in a parent project/folder/organization.
|
SavedQuery |
createSavedQuery(FolderName parent,
SavedQuery savedQuery,
String savedQueryId)
Creates a saved query in a parent project/folder/organization.
|
SavedQuery |
createSavedQuery(OrganizationName parent,
SavedQuery savedQuery,
String savedQueryId)
Creates a saved query in a parent project/folder/organization.
|
SavedQuery |
createSavedQuery(ProjectName parent,
SavedQuery savedQuery,
String savedQueryId)
Creates a saved query in a parent project/folder/organization.
|
SavedQuery |
createSavedQuery(String parent,
SavedQuery savedQuery,
String savedQueryId)
Creates a saved query in a parent project/folder/organization.
|
UnaryCallable<CreateSavedQueryRequest,SavedQuery> |
createSavedQueryCallable()
Creates a saved query in a parent project/folder/organization.
|
void |
deleteFeed(DeleteFeedRequest request)
Deletes an asset feed.
|
void |
deleteFeed(FeedName name)
Deletes an asset feed.
|
void |
deleteFeed(String name)
Deletes an asset feed.
|
UnaryCallable<DeleteFeedRequest,Empty> |
deleteFeedCallable()
Deletes an asset feed.
|
void |
deleteSavedQuery(DeleteSavedQueryRequest request)
Deletes a saved query.
|
void |
deleteSavedQuery(SavedQueryName name)
Deletes a saved query.
|
void |
deleteSavedQuery(String name)
Deletes a saved query.
|
UnaryCallable<DeleteSavedQueryRequest,Empty> |
deleteSavedQueryCallable()
Deletes a saved query.
|
OperationFuture<ExportAssetsResponse,ExportAssetsRequest> |
exportAssetsAsync(ExportAssetsRequest request)
Exports assets with time and resource types to a given Cloud Storage location/BigQuery table.
|
UnaryCallable<ExportAssetsRequest,Operation> |
exportAssetsCallable()
Exports assets with time and resource types to a given Cloud Storage location/BigQuery table.
|
OperationCallable<ExportAssetsRequest,ExportAssetsResponse,ExportAssetsRequest> |
exportAssetsOperationCallable()
Exports assets with time and resource types to a given Cloud Storage location/BigQuery table.
|
Feed |
getFeed(FeedName name)
Gets details about an asset feed.
|
Feed |
getFeed(GetFeedRequest request)
Gets details about an asset feed.
|
Feed |
getFeed(String name)
Gets details about an asset feed.
|
UnaryCallable<GetFeedRequest,Feed> |
getFeedCallable()
Gets details about an asset feed.
|
OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
SavedQuery |
getSavedQuery(GetSavedQueryRequest request)
Gets details about a saved query.
|
SavedQuery |
getSavedQuery(SavedQueryName name)
Gets details about a saved query.
|
SavedQuery |
getSavedQuery(String name)
Gets details about a saved query.
|
UnaryCallable<GetSavedQueryRequest,SavedQuery> |
getSavedQueryCallable()
Gets details about a saved query.
|
AssetServiceSettings |
getSettings() |
AssetServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
AssetServiceClient.ListAssetsPagedResponse |
listAssets(ListAssetsRequest request)
Lists assets with time and resource types and returns paged results in response.
|
AssetServiceClient.ListAssetsPagedResponse |
listAssets(com.google.api.resourcenames.ResourceName parent)
Lists assets with time and resource types and returns paged results in response.
|
AssetServiceClient.ListAssetsPagedResponse |
listAssets(String parent)
Lists assets with time and resource types and returns paged results in response.
|
UnaryCallable<ListAssetsRequest,ListAssetsResponse> |
listAssetsCallable()
Lists assets with time and resource types and returns paged results in response.
|
UnaryCallable<ListAssetsRequest,AssetServiceClient.ListAssetsPagedResponse> |
listAssetsPagedCallable()
Lists assets with time and resource types and returns paged results in response.
|
ListFeedsResponse |
listFeeds(ListFeedsRequest request)
Lists all asset feeds in a parent project/folder/organization.
|
ListFeedsResponse |
listFeeds(String parent)
Lists all asset feeds in a parent project/folder/organization.
|
UnaryCallable<ListFeedsRequest,ListFeedsResponse> |
listFeedsCallable()
Lists all asset feeds in a parent project/folder/organization.
|
AssetServiceClient.ListSavedQueriesPagedResponse |
listSavedQueries(FolderName parent)
Lists all saved queries in a parent project/folder/organization.
|
AssetServiceClient.ListSavedQueriesPagedResponse |
listSavedQueries(ListSavedQueriesRequest request)
Lists all saved queries in a parent project/folder/organization.
|
AssetServiceClient.ListSavedQueriesPagedResponse |
listSavedQueries(OrganizationName parent)
Lists all saved queries in a parent project/folder/organization.
|
AssetServiceClient.ListSavedQueriesPagedResponse |
listSavedQueries(ProjectName parent)
Lists all saved queries in a parent project/folder/organization.
|
AssetServiceClient.ListSavedQueriesPagedResponse |
listSavedQueries(String parent)
Lists all saved queries in a parent project/folder/organization.
|
UnaryCallable<ListSavedQueriesRequest,ListSavedQueriesResponse> |
listSavedQueriesCallable()
Lists all saved queries in a parent project/folder/organization.
|
UnaryCallable<ListSavedQueriesRequest,AssetServiceClient.ListSavedQueriesPagedResponse> |
listSavedQueriesPagedCallable()
Lists all saved queries in a parent project/folder/organization.
|
QueryAssetsResponse |
queryAssets(QueryAssetsRequest request)
Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard
SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql).
|
UnaryCallable<QueryAssetsRequest,QueryAssetsResponse> |
queryAssetsCallable()
Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard
SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql).
|
AssetServiceClient.SearchAllIamPoliciesPagedResponse |
searchAllIamPolicies(SearchAllIamPoliciesRequest request)
Searches all IAM policies within the specified scope, such as a project, folder, or
organization.
|
AssetServiceClient.SearchAllIamPoliciesPagedResponse |
searchAllIamPolicies(String scope,
String query)
Searches all IAM policies within the specified scope, such as a project, folder, or
organization.
|
UnaryCallable<SearchAllIamPoliciesRequest,SearchAllIamPoliciesResponse> |
searchAllIamPoliciesCallable()
Searches all IAM policies within the specified scope, such as a project, folder, or
organization.
|
UnaryCallable<SearchAllIamPoliciesRequest,AssetServiceClient.SearchAllIamPoliciesPagedResponse> |
searchAllIamPoliciesPagedCallable()
Searches all IAM policies within the specified scope, such as a project, folder, or
organization.
|
AssetServiceClient.SearchAllResourcesPagedResponse |
searchAllResources(SearchAllResourcesRequest request)
Searches all Cloud resources within the specified scope, such as a project, folder, or
organization.
|
AssetServiceClient.SearchAllResourcesPagedResponse |
searchAllResources(String scope,
String query,
List<String> assetTypes)
Searches all Cloud resources within the specified scope, such as a project, folder, or
organization.
|
UnaryCallable<SearchAllResourcesRequest,SearchAllResourcesResponse> |
searchAllResourcesCallable()
Searches all Cloud resources within the specified scope, such as a project, folder, or
organization.
|
UnaryCallable<SearchAllResourcesRequest,AssetServiceClient.SearchAllResourcesPagedResponse> |
searchAllResourcesPagedCallable()
Searches all Cloud resources within the specified scope, such as a project, folder, or
organization.
|
void |
shutdown() |
void |
shutdownNow() |
Feed |
updateFeed(Feed feed)
Updates an asset feed configuration.
|
Feed |
updateFeed(UpdateFeedRequest request)
Updates an asset feed configuration.
|
UnaryCallable<UpdateFeedRequest,Feed> |
updateFeedCallable()
Updates an asset feed configuration.
|
SavedQuery |
updateSavedQuery(SavedQuery savedQuery,
FieldMask updateMask)
Updates a saved query.
|
SavedQuery |
updateSavedQuery(UpdateSavedQueryRequest request)
Updates a saved query.
|
UnaryCallable<UpdateSavedQueryRequest,SavedQuery> |
updateSavedQueryCallable()
Updates a saved query.
|
protected AssetServiceClient(AssetServiceSettings settings) throws IOException
IOException
protected AssetServiceClient(AssetServiceStub stub)
public static final AssetServiceClient create() throws IOException
IOException
public static final AssetServiceClient create(AssetServiceSettings settings) throws IOException
IOException
public static final AssetServiceClient create(AssetServiceStub stub)
public final AssetServiceSettings getSettings()
public AssetServiceStub getStub()
public final OperationsClient getOperationsClient()
@BetaApi public final OperationsClient getHttpJsonOperationsClient()
public final OperationFuture<ExportAssetsResponse,ExportAssetsRequest> exportAssetsAsync(ExportAssetsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ExportAssetsRequest request =
ExportAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setReadTime(Timestamp.newBuilder().build())
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setOutputConfig(OutputConfig.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
ExportAssetsResponse response = assetServiceClient.exportAssetsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<ExportAssetsRequest,ExportAssetsResponse,ExportAssetsRequest> exportAssetsOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ExportAssetsRequest request =
ExportAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setReadTime(Timestamp.newBuilder().build())
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setOutputConfig(OutputConfig.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
OperationFuture<ExportAssetsResponse, ExportAssetsRequest> future =
assetServiceClient.exportAssetsOperationCallable().futureCall(request);
// Do something.
ExportAssetsResponse response = future.get();
}
public final UnaryCallable<ExportAssetsRequest,Operation> exportAssetsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ExportAssetsRequest request =
ExportAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setReadTime(Timestamp.newBuilder().build())
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setOutputConfig(OutputConfig.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
ApiFuture<Operation> future = assetServiceClient.exportAssetsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final AssetServiceClient.ListAssetsPagedResponse listAssets(com.google.api.resourcenames.ResourceName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ResourceName parent = FolderName.of("[FOLDER]");
for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. Name of the organization, folder, or project the assets belong to.
Format: "organizations/[organization-number]" (such as "organizations/123"),
"projects/[project-id]" (such as "projects/my-project-id"), "projects/[project-number]"
(such as "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").ApiException
- if the remote call failspublic final AssetServiceClient.ListAssetsPagedResponse listAssets(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
for (Asset element : assetServiceClient.listAssets(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. Name of the organization, folder, or project the assets belong to.
Format: "organizations/[organization-number]" (such as "organizations/123"),
"projects/[project-id]" (such as "projects/my-project-id"), "projects/[project-number]"
(such as "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").ApiException
- if the remote call failspublic final AssetServiceClient.ListAssetsPagedResponse listAssets(ListAssetsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListAssetsRequest request =
ListAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setReadTime(Timestamp.newBuilder().build())
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllRelationshipTypes(new ArrayList<String>())
.build();
for (Asset element : assetServiceClient.listAssets(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListAssetsRequest,AssetServiceClient.ListAssetsPagedResponse> listAssetsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListAssetsRequest request =
ListAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setReadTime(Timestamp.newBuilder().build())
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllRelationshipTypes(new ArrayList<String>())
.build();
ApiFuture<Asset> future = assetServiceClient.listAssetsPagedCallable().futureCall(request);
// Do something.
for (Asset element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListAssetsRequest,ListAssetsResponse> listAssetsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListAssetsRequest request =
ListAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setReadTime(Timestamp.newBuilder().build())
.addAllAssetTypes(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllRelationshipTypes(new ArrayList<String>())
.build();
while (true) {
ListAssetsResponse response = assetServiceClient.listAssetsCallable().call(request);
for (Asset element : response.getAssetsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(BatchGetAssetsHistoryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetAssetsHistoryRequest request =
BatchGetAssetsHistoryRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.addAllAssetNames(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setReadTimeWindow(TimeWindow.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<BatchGetAssetsHistoryRequest,BatchGetAssetsHistoryResponse> batchGetAssetsHistoryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetAssetsHistoryRequest request =
BatchGetAssetsHistoryRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.addAllAssetNames(new ArrayList<String>())
.setContentType(ContentType.forNumber(0))
.setReadTimeWindow(TimeWindow.newBuilder().build())
.addAllRelationshipTypes(new ArrayList<String>())
.build();
ApiFuture<BatchGetAssetsHistoryResponse> future =
assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request);
// Do something.
BatchGetAssetsHistoryResponse response = future.get();
}
public final Feed createFeed(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = "parent-995424086";
Feed response = assetServiceClient.createFeed(parent);
}
parent
- Required. The name of the project/folder/organization where this feed should be
created in. It can only be an organization number (such as "organizations/123"), a folder
number (such as "folders/123"), a project ID (such as "projects/my-project-id")", or a
project number (such as "projects/12345").ApiException
- if the remote call failspublic final Feed createFeed(CreateFeedRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
CreateFeedRequest request =
CreateFeedRequest.newBuilder()
.setParent("parent-995424086")
.setFeedId("feedId-1278410919")
.setFeed(Feed.newBuilder().build())
.build();
Feed response = assetServiceClient.createFeed(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<CreateFeedRequest,Feed> createFeedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
CreateFeedRequest request =
CreateFeedRequest.newBuilder()
.setParent("parent-995424086")
.setFeedId("feedId-1278410919")
.setFeed(Feed.newBuilder().build())
.build();
ApiFuture<Feed> future = assetServiceClient.createFeedCallable().futureCall(request);
// Do something.
Feed response = future.get();
}
public final Feed getFeed(FeedName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
Feed response = assetServiceClient.getFeed(name);
}
name
- Required. The name of the Feed and it must be in the format of:
projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
organizations/organization_number/feeds/feed_idApiException
- if the remote call failspublic final Feed getFeed(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
Feed response = assetServiceClient.getFeed(name);
}
name
- Required. The name of the Feed and it must be in the format of:
projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
organizations/organization_number/feeds/feed_idApiException
- if the remote call failspublic final Feed getFeed(GetFeedRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
GetFeedRequest request =
GetFeedRequest.newBuilder()
.setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
.build();
Feed response = assetServiceClient.getFeed(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetFeedRequest,Feed> getFeedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
GetFeedRequest request =
GetFeedRequest.newBuilder()
.setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
.build();
ApiFuture<Feed> future = assetServiceClient.getFeedCallable().futureCall(request);
// Do something.
Feed response = future.get();
}
public final ListFeedsResponse listFeeds(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = "parent-995424086";
ListFeedsResponse response = assetServiceClient.listFeeds(parent);
}
parent
- Required. The parent project/folder/organization whose feeds are to be listed. It
can only be using project/folder/organization number (such as "folders/12345")", or a
project ID (such as "projects/my-project-id").ApiException
- if the remote call failspublic final ListFeedsResponse listFeeds(ListFeedsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListFeedsRequest request =
ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
ListFeedsResponse response = assetServiceClient.listFeeds(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListFeedsRequest,ListFeedsResponse> listFeedsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListFeedsRequest request =
ListFeedsRequest.newBuilder().setParent("parent-995424086").build();
ApiFuture<ListFeedsResponse> future =
assetServiceClient.listFeedsCallable().futureCall(request);
// Do something.
ListFeedsResponse response = future.get();
}
public final Feed updateFeed(Feed feed)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
Feed feed = Feed.newBuilder().build();
Feed response = assetServiceClient.updateFeed(feed);
}
feed
- 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.ApiException
- if the remote call failspublic final Feed updateFeed(UpdateFeedRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
UpdateFeedRequest request =
UpdateFeedRequest.newBuilder()
.setFeed(Feed.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Feed response = assetServiceClient.updateFeed(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<UpdateFeedRequest,Feed> updateFeedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
UpdateFeedRequest request =
UpdateFeedRequest.newBuilder()
.setFeed(Feed.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Feed> future = assetServiceClient.updateFeedCallable().futureCall(request);
// Do something.
Feed response = future.get();
}
public final void deleteFeed(FeedName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
assetServiceClient.deleteFeed(name);
}
name
- Required. The name of the feed and it must be in the format of:
projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
organizations/organization_number/feeds/feed_idApiException
- if the remote call failspublic final void deleteFeed(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString();
assetServiceClient.deleteFeed(name);
}
name
- Required. The name of the feed and it must be in the format of:
projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
organizations/organization_number/feeds/feed_idApiException
- if the remote call failspublic final void deleteFeed(DeleteFeedRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
DeleteFeedRequest request =
DeleteFeedRequest.newBuilder()
.setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
.build();
assetServiceClient.deleteFeed(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<DeleteFeedRequest,Empty> deleteFeedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
DeleteFeedRequest request =
DeleteFeedRequest.newBuilder()
.setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString())
.build();
ApiFuture<Empty> future = assetServiceClient.deleteFeedCallable().futureCall(request);
// Do something.
future.get();
}
public final AssetServiceClient.SearchAllResourcesPagedResponse searchAllResources(String scope, String query, List<String> assetTypes)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String scope = "scope109264468";
String query = "query107944136";
List<String> assetTypes = new ArrayList<>();
for (ResourceSearchResult element :
assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
// doThingsWith(element);
}
}
scope
- Required. A scope can be a project, a folder, or an organization. The search is
limited to the resources within the `scope`. The caller must be granted the
[`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
permission on the desired scope.
The allowed values are:
query
- Optional. The query statement. See [how to construct a
query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
for more information. If not specified or empty, it will search all the resources within
the specified `scope`.
Examples:
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).
Regular expressions are also supported. For example:
See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned.
ApiException
- if the remote call failspublic final AssetServiceClient.SearchAllResourcesPagedResponse searchAllResources(SearchAllResourcesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SearchAllResourcesRequest request =
SearchAllResourcesRequest.newBuilder()
.setScope("scope109264468")
.setQuery("query107944136")
.addAllAssetTypes(new ArrayList<String>())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOrderBy("orderBy-1207110587")
.setReadMask(FieldMask.newBuilder().build())
.build();
for (ResourceSearchResult element :
assetServiceClient.searchAllResources(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<SearchAllResourcesRequest,AssetServiceClient.SearchAllResourcesPagedResponse> searchAllResourcesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SearchAllResourcesRequest request =
SearchAllResourcesRequest.newBuilder()
.setScope("scope109264468")
.setQuery("query107944136")
.addAllAssetTypes(new ArrayList<String>())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOrderBy("orderBy-1207110587")
.setReadMask(FieldMask.newBuilder().build())
.build();
ApiFuture<ResourceSearchResult> future =
assetServiceClient.searchAllResourcesPagedCallable().futureCall(request);
// Do something.
for (ResourceSearchResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<SearchAllResourcesRequest,SearchAllResourcesResponse> searchAllResourcesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SearchAllResourcesRequest request =
SearchAllResourcesRequest.newBuilder()
.setScope("scope109264468")
.setQuery("query107944136")
.addAllAssetTypes(new ArrayList<String>())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOrderBy("orderBy-1207110587")
.setReadMask(FieldMask.newBuilder().build())
.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 AssetServiceClient.SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope, String query)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String scope = "scope109264468";
String query = "query107944136";
for (IamPolicySearchResult element :
assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
// doThingsWith(element);
}
}
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 caller must be granted the
[`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
permission on the desired scope.
The allowed values are:
query
- Optional. The query statement. See [how to construct a
query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
for more information. If not specified or empty, it will search all the IAM policies within
the specified `scope`. Note that the query string is compared against each Cloud IAM policy
binding, including its principals, roles, and Cloud IAM conditions. The returned Cloud IAM
policies will only contain the bindings that match your query. To learn more about the IAM
policy structure, see the [IAM policy
documentation](https://cloud.google.com/iam/help/allow-policies/structure).
Examples:
ApiException
- if the remote call failspublic final AssetServiceClient.SearchAllIamPoliciesPagedResponse searchAllIamPolicies(SearchAllIamPoliciesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SearchAllIamPoliciesRequest request =
SearchAllIamPoliciesRequest.newBuilder()
.setScope("scope109264468")
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllAssetTypes(new ArrayList<String>())
.setOrderBy("orderBy-1207110587")
.build();
for (IamPolicySearchResult element :
assetServiceClient.searchAllIamPolicies(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<SearchAllIamPoliciesRequest,AssetServiceClient.SearchAllIamPoliciesPagedResponse> searchAllIamPoliciesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SearchAllIamPoliciesRequest request =
SearchAllIamPoliciesRequest.newBuilder()
.setScope("scope109264468")
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllAssetTypes(new ArrayList<String>())
.setOrderBy("orderBy-1207110587")
.build();
ApiFuture<IamPolicySearchResult> future =
assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request);
// Do something.
for (IamPolicySearchResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<SearchAllIamPoliciesRequest,SearchAllIamPoliciesResponse> searchAllIamPoliciesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SearchAllIamPoliciesRequest request =
SearchAllIamPoliciesRequest.newBuilder()
.setScope("scope109264468")
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.addAllAssetTypes(new ArrayList<String>())
.setOrderBy("orderBy-1207110587")
.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 AnalyzeIamPolicyResponse analyzeIamPolicy(AnalyzeIamPolicyRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyRequest request =
AnalyzeIamPolicyRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setSavedAnalysisQuery("savedAnalysisQuery376058885")
.setExecutionTimeout(Duration.newBuilder().build())
.build();
AnalyzeIamPolicyResponse response = assetServiceClient.analyzeIamPolicy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<AnalyzeIamPolicyRequest,AnalyzeIamPolicyResponse> analyzeIamPolicyCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyRequest request =
AnalyzeIamPolicyRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setSavedAnalysisQuery("savedAnalysisQuery376058885")
.setExecutionTimeout(Duration.newBuilder().build())
.build();
ApiFuture<AnalyzeIamPolicyResponse> future =
assetServiceClient.analyzeIamPolicyCallable().futureCall(request);
// Do something.
AnalyzeIamPolicyResponse response = future.get();
}
public final OperationFuture<AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata> analyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyLongrunningRequest request =
AnalyzeIamPolicyLongrunningRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setSavedAnalysisQuery("savedAnalysisQuery376058885")
.setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
.build();
AnalyzeIamPolicyLongrunningResponse response =
assetServiceClient.analyzeIamPolicyLongrunningAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<AnalyzeIamPolicyLongrunningRequest,AnalyzeIamPolicyLongrunningResponse,AnalyzeIamPolicyLongrunningMetadata> analyzeIamPolicyLongrunningOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyLongrunningRequest request =
AnalyzeIamPolicyLongrunningRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setSavedAnalysisQuery("savedAnalysisQuery376058885")
.setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
.build();
OperationFuture<AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningMetadata>
future =
assetServiceClient.analyzeIamPolicyLongrunningOperationCallable().futureCall(request);
// Do something.
AnalyzeIamPolicyLongrunningResponse response = future.get();
}
public final UnaryCallable<AnalyzeIamPolicyLongrunningRequest,Operation> analyzeIamPolicyLongrunningCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeIamPolicyLongrunningRequest request =
AnalyzeIamPolicyLongrunningRequest.newBuilder()
.setAnalysisQuery(IamPolicyAnalysisQuery.newBuilder().build())
.setSavedAnalysisQuery("savedAnalysisQuery376058885")
.setOutputConfig(IamPolicyAnalysisOutputConfig.newBuilder().build())
.build();
ApiFuture<Operation> future =
assetServiceClient.analyzeIamPolicyLongrunningCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final AnalyzeMoveResponse analyzeMove(AnalyzeMoveRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeMoveRequest request =
AnalyzeMoveRequest.newBuilder()
.setResource("resource-341064690")
.setDestinationParent("destinationParent-1733659048")
.build();
AnalyzeMoveResponse response = assetServiceClient.analyzeMove(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<AnalyzeMoveRequest,AnalyzeMoveResponse> analyzeMoveCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
AnalyzeMoveRequest request =
AnalyzeMoveRequest.newBuilder()
.setResource("resource-341064690")
.setDestinationParent("destinationParent-1733659048")
.build();
ApiFuture<AnalyzeMoveResponse> future =
assetServiceClient.analyzeMoveCallable().futureCall(request);
// Do something.
AnalyzeMoveResponse response = future.get();
}
public final QueryAssetsResponse queryAssets(QueryAssetsRequest request)
If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`.
Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call.
Note, the query result has approximately 10 GB limitation enforced by BigQuery https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger results will result in errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
QueryAssetsRequest request =
QueryAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setTimeout(Duration.newBuilder().build())
.setOutputConfig(QueryAssetsOutputConfig.newBuilder().build())
.build();
QueryAssetsResponse response = assetServiceClient.queryAssets(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<QueryAssetsRequest,QueryAssetsResponse> queryAssetsCallable()
If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`.
Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call.
Note, the query result has approximately 10 GB limitation enforced by BigQuery https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger results will result in errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
QueryAssetsRequest request =
QueryAssetsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setTimeout(Duration.newBuilder().build())
.setOutputConfig(QueryAssetsOutputConfig.newBuilder().build())
.build();
ApiFuture<QueryAssetsResponse> future =
assetServiceClient.queryAssetsCallable().futureCall(request);
// Do something.
QueryAssetsResponse response = future.get();
}
public final SavedQuery createSavedQuery(FolderName parent, SavedQuery savedQuery, String savedQueryId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FolderName parent = FolderName.of("[FOLDER]");
SavedQuery savedQuery = SavedQuery.newBuilder().build();
String savedQueryId = "savedQueryId378086268";
SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
}
parent
- Required. The name of the project/folder/organization where this saved_query
should be created in. It can only be an organization number (such as "organizations/123"),
a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id")",
or a project number (such as "projects/12345").savedQuery
- Required. The saved_query details. The `name` field must be empty as it will
be generated based on the parent and saved_query_id.savedQueryId
- Required. The ID to use for the saved query, which must be unique in the
specified parent. It will become the final component of the saved query's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.
ApiException
- if the remote call failspublic final SavedQuery createSavedQuery(OrganizationName parent, SavedQuery savedQuery, String savedQueryId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
SavedQuery savedQuery = SavedQuery.newBuilder().build();
String savedQueryId = "savedQueryId378086268";
SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
}
parent
- Required. The name of the project/folder/organization where this saved_query
should be created in. It can only be an organization number (such as "organizations/123"),
a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id")",
or a project number (such as "projects/12345").savedQuery
- Required. The saved_query details. The `name` field must be empty as it will
be generated based on the parent and saved_query_id.savedQueryId
- Required. The ID to use for the saved query, which must be unique in the
specified parent. It will become the final component of the saved query's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.
ApiException
- if the remote call failspublic final SavedQuery createSavedQuery(ProjectName parent, SavedQuery savedQuery, String savedQueryId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SavedQuery savedQuery = SavedQuery.newBuilder().build();
String savedQueryId = "savedQueryId378086268";
SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
}
parent
- Required. The name of the project/folder/organization where this saved_query
should be created in. It can only be an organization number (such as "organizations/123"),
a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id")",
or a project number (such as "projects/12345").savedQuery
- Required. The saved_query details. The `name` field must be empty as it will
be generated based on the parent and saved_query_id.savedQueryId
- Required. The ID to use for the saved query, which must be unique in the
specified parent. It will become the final component of the saved query's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.
ApiException
- if the remote call failspublic final SavedQuery createSavedQuery(String parent, SavedQuery savedQuery, String savedQueryId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
SavedQuery savedQuery = SavedQuery.newBuilder().build();
String savedQueryId = "savedQueryId378086268";
SavedQuery response = assetServiceClient.createSavedQuery(parent, savedQuery, savedQueryId);
}
parent
- Required. The name of the project/folder/organization where this saved_query
should be created in. It can only be an organization number (such as "organizations/123"),
a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id")",
or a project number (such as "projects/12345").savedQuery
- Required. The saved_query details. The `name` field must be empty as it will
be generated based on the parent and saved_query_id.savedQueryId
- Required. The ID to use for the saved query, which must be unique in the
specified parent. It will become the final component of the saved query's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.
ApiException
- if the remote call failspublic final SavedQuery createSavedQuery(CreateSavedQueryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
CreateSavedQueryRequest request =
CreateSavedQueryRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setSavedQuery(SavedQuery.newBuilder().build())
.setSavedQueryId("savedQueryId378086268")
.build();
SavedQuery response = assetServiceClient.createSavedQuery(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<CreateSavedQueryRequest,SavedQuery> createSavedQueryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
CreateSavedQueryRequest request =
CreateSavedQueryRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setSavedQuery(SavedQuery.newBuilder().build())
.setSavedQueryId("savedQueryId378086268")
.build();
ApiFuture<SavedQuery> future =
assetServiceClient.createSavedQueryCallable().futureCall(request);
// Do something.
SavedQuery response = future.get();
}
public final SavedQuery getSavedQuery(SavedQueryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SavedQueryName name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]");
SavedQuery response = assetServiceClient.getSavedQuery(name);
}
name
- Required. The name of the saved query and it must be in the format of:
ApiException
- if the remote call failspublic final SavedQuery getSavedQuery(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString();
SavedQuery response = assetServiceClient.getSavedQuery(name);
}
name
- Required. The name of the saved query and it must be in the format of:
ApiException
- if the remote call failspublic final SavedQuery getSavedQuery(GetSavedQueryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
GetSavedQueryRequest request =
GetSavedQueryRequest.newBuilder()
.setName(
SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
.build();
SavedQuery response = assetServiceClient.getSavedQuery(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetSavedQueryRequest,SavedQuery> getSavedQueryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
GetSavedQueryRequest request =
GetSavedQueryRequest.newBuilder()
.setName(
SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
.build();
ApiFuture<SavedQuery> future = assetServiceClient.getSavedQueryCallable().futureCall(request);
// Do something.
SavedQuery response = future.get();
}
public final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(FolderName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
FolderName parent = FolderName.of("[FOLDER]");
for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent project/folder/organization whose savedQueries are to be
listed. It can only be using project/folder/organization number (such as "folders/12345")",
or a project ID (such as "projects/my-project-id").ApiException
- if the remote call failspublic final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(OrganizationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent project/folder/organization whose savedQueries are to be
listed. It can only be using project/folder/organization number (such as "folders/12345")",
or a project ID (such as "projects/my-project-id").ApiException
- if the remote call failspublic final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(ProjectName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent project/folder/organization whose savedQueries are to be
listed. It can only be using project/folder/organization number (such as "folders/12345")",
or a project ID (such as "projects/my-project-id").ApiException
- if the remote call failspublic final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
for (SavedQuery element : assetServiceClient.listSavedQueries(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent project/folder/organization whose savedQueries are to be
listed. It can only be using project/folder/organization number (such as "folders/12345")",
or a project ID (such as "projects/my-project-id").ApiException
- if the remote call failspublic final AssetServiceClient.ListSavedQueriesPagedResponse listSavedQueries(ListSavedQueriesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListSavedQueriesRequest request =
ListSavedQueriesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (SavedQuery element : assetServiceClient.listSavedQueries(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListSavedQueriesRequest,AssetServiceClient.ListSavedQueriesPagedResponse> listSavedQueriesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListSavedQueriesRequest request =
ListSavedQueriesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<SavedQuery> future =
assetServiceClient.listSavedQueriesPagedCallable().futureCall(request);
// Do something.
for (SavedQuery element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListSavedQueriesRequest,ListSavedQueriesResponse> listSavedQueriesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
ListSavedQueriesRequest request =
ListSavedQueriesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListSavedQueriesResponse response =
assetServiceClient.listSavedQueriesCallable().call(request);
for (SavedQuery element : response.getSavedQueriesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final SavedQuery updateSavedQuery(SavedQuery savedQuery, FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SavedQuery savedQuery = SavedQuery.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
SavedQuery response = assetServiceClient.updateSavedQuery(savedQuery, updateMask);
}
savedQuery
- Required. The saved query to update.
The saved query's `name` field is used to identify the one to update, which has format as below:
updateMask
- Required. The list of fields to update.ApiException
- if the remote call failspublic final SavedQuery updateSavedQuery(UpdateSavedQueryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
UpdateSavedQueryRequest request =
UpdateSavedQueryRequest.newBuilder()
.setSavedQuery(SavedQuery.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
SavedQuery response = assetServiceClient.updateSavedQuery(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<UpdateSavedQueryRequest,SavedQuery> updateSavedQueryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
UpdateSavedQueryRequest request =
UpdateSavedQueryRequest.newBuilder()
.setSavedQuery(SavedQuery.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<SavedQuery> future =
assetServiceClient.updateSavedQueryCallable().futureCall(request);
// Do something.
SavedQuery response = future.get();
}
public final void deleteSavedQuery(SavedQueryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
SavedQueryName name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]");
assetServiceClient.deleteSavedQuery(name);
}
name
- Required. The name of the saved query to delete. It must be in the format of:
ApiException
- if the remote call failspublic final void deleteSavedQuery(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
String name = SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString();
assetServiceClient.deleteSavedQuery(name);
}
name
- Required. The name of the saved query to delete. It must be in the format of:
ApiException
- if the remote call failspublic final void deleteSavedQuery(DeleteSavedQueryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
DeleteSavedQueryRequest request =
DeleteSavedQueryRequest.newBuilder()
.setName(
SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
.build();
assetServiceClient.deleteSavedQuery(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<DeleteSavedQueryRequest,Empty> deleteSavedQueryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
DeleteSavedQueryRequest request =
DeleteSavedQueryRequest.newBuilder()
.setName(
SavedQueryName.ofProjectSavedQueryName("[PROJECT]", "[SAVED_QUERY]").toString())
.build();
ApiFuture<Empty> future = assetServiceClient.deleteSavedQueryCallable().futureCall(request);
// Do something.
future.get();
}
public final BatchGetEffectiveIamPoliciesResponse batchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetEffectiveIamPoliciesRequest request =
BatchGetEffectiveIamPoliciesRequest.newBuilder()
.setScope(FolderName.of("[FOLDER]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchGetEffectiveIamPoliciesResponse response =
assetServiceClient.batchGetEffectiveIamPolicies(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<BatchGetEffectiveIamPoliciesRequest,BatchGetEffectiveIamPoliciesResponse> batchGetEffectiveIamPoliciesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
BatchGetEffectiveIamPoliciesRequest request =
BatchGetEffectiveIamPoliciesRequest.newBuilder()
.setScope(FolderName.of("[FOLDER]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchGetEffectiveIamPoliciesResponse> future =
assetServiceClient.batchGetEffectiveIamPoliciesCallable().futureCall(request);
// Do something.
BatchGetEffectiveIamPoliciesResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2022 Google LLC. All rights reserved.