Search in sources :

Example 11 with AssetServiceClient

use of com.google.cloud.asset.v1.AssetServiceClient in project gapic-generator-java by googleapis.

the class AsyncCreateFeed method asyncCreateFeed.

public static void asyncCreateFeed() throws Exception {
    // It may require modifications to work in your environment.
    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();
    }
}
Also used : AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) CreateFeedRequest(com.google.cloud.asset.v1.CreateFeedRequest) Feed(com.google.cloud.asset.v1.Feed)

Example 12 with AssetServiceClient

use of com.google.cloud.asset.v1.AssetServiceClient in project gapic-generator-java by googleapis.

the class SyncCreateFeed method syncCreateFeed.

public static void syncCreateFeed() throws Exception {
    // It may require modifications to work in your environment.
    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);
    }
}
Also used : AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) CreateFeedRequest(com.google.cloud.asset.v1.CreateFeedRequest) Feed(com.google.cloud.asset.v1.Feed)

Example 13 with AssetServiceClient

use of com.google.cloud.asset.v1.AssetServiceClient in project gapic-generator-java by googleapis.

the class AsyncListAssetsPaged method asyncListAssetsPaged.

public static void asyncListAssetsPaged() throws Exception {
    // It may require modifications to work in your environment.
    try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
        ListAssetsRequest request = ListAssetsRequest.newBuilder().setParent(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").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.getResponsesList()) {
            // doThingsWith(element);
            }
            String nextPageToken = response.getNextPageToken();
            if (!Strings.isNullOrEmpty(nextPageToken)) {
                request = request.toBuilder().setPageToken(nextPageToken).build();
            } else {
                break;
            }
        }
    }
}
Also used : ListAssetsRequest(com.google.cloud.asset.v1.ListAssetsRequest) AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) ArrayList(java.util.ArrayList) Asset(com.google.cloud.asset.v1.Asset) ListAssetsResponse(com.google.cloud.asset.v1.ListAssetsResponse)

Example 14 with AssetServiceClient

use of com.google.cloud.asset.v1.AssetServiceClient in project gapic-generator-java by googleapis.

the class SyncSearchAllIamPoliciesStringString method syncSearchAllIamPoliciesStringString.

public static void syncSearchAllIamPoliciesStringString() throws Exception {
    // It may require modifications to work in your environment.
    try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
        String scope = "scope109264468";
        String query = "query107944136";
        for (IamPolicySearchResult element : assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
        // doThingsWith(element);
        }
    }
}
Also used : AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) IamPolicySearchResult(com.google.cloud.asset.v1.IamPolicySearchResult)

Example 15 with AssetServiceClient

use of com.google.cloud.asset.v1.AssetServiceClient in project gapic-generator-java by googleapis.

the class AsyncSearchAllResources method asyncSearchAllResources.

public static void asyncSearchAllResources() throws Exception {
    // It may require modifications to work in your environment.
    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);
        }
    }
}
Also used : AssetServiceClient(com.google.cloud.asset.v1.AssetServiceClient) SearchAllResourcesRequest(com.google.cloud.asset.v1.SearchAllResourcesRequest) ResourceSearchResult(com.google.cloud.asset.v1.ResourceSearchResult) ArrayList(java.util.ArrayList)

Aggregations

AssetServiceClient (com.google.cloud.asset.v1.AssetServiceClient)52 Feed (com.google.cloud.asset.v1.Feed)13 ArrayList (java.util.ArrayList)9 IOException (java.io.IOException)6 ApiException (com.google.api.gax.rpc.ApiException)5 AnalyzeIamPolicyLongrunningRequest (com.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest)5 ExportAssetsRequest (com.google.cloud.asset.v1.ExportAssetsRequest)5 ExportAssetsResponse (com.google.cloud.asset.v1.ExportAssetsResponse)4 ListFeedsResponse (com.google.cloud.asset.v1.ListFeedsResponse)4 ProjectName (com.google.cloud.asset.v1.ProjectName)4 AnalyzeIamPolicyRequest (com.google.cloud.asset.v1.AnalyzeIamPolicyRequest)3 AnalyzeIamPolicyResponse (com.google.cloud.asset.v1.AnalyzeIamPolicyResponse)3 CreateFeedRequest (com.google.cloud.asset.v1.CreateFeedRequest)3 IamPolicyAnalysisQuery (com.google.cloud.asset.v1.IamPolicyAnalysisQuery)3 Options (com.google.cloud.asset.v1.IamPolicyAnalysisQuery.Options)3 ResourceSelector (com.google.cloud.asset.v1.IamPolicyAnalysisQuery.ResourceSelector)3 IamPolicySearchResult (com.google.cloud.asset.v1.IamPolicySearchResult)3 ListAssetsRequest (com.google.cloud.asset.v1.ListAssetsRequest)3 ResourceSearchResult (com.google.cloud.asset.v1.ResourceSearchResult)3 SearchAllIamPoliciesRequest (com.google.cloud.asset.v1.SearchAllIamPoliciesRequest)3