Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

fix: migrate to grpc_service_config #238

Merged
merged 2 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>7.0.0</version>
<version>7.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -38,7 +38,7 @@ If you are using Maven without BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-asset</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
</dependency>

```
Expand Down Expand Up @@ -86,6 +86,25 @@ use this Cloud Asset Inventory Client Library.



## Samples

Samples are in the [`samples/`](https://github.com/googleapis/java-asset/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Batch Get Assets History Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java) |
| Create Feed Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/CreateFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/CreateFeedExample.java) |
| Delete Feed Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/DeleteFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/DeleteFeedExample.java) |
| Export Assets Bigquery Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/ExportAssetsBigqueryExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/ExportAssetsBigqueryExample.java) |
| Export Assets Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/ExportAssetsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/ExportAssetsExample.java) |
| Get Feed Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/GetFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/GetFeedExample.java) |
| List Feeds Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/ListFeedsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/ListFeedsExample.java) |
| Search All Iam Policies Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/SearchAllIamPoliciesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/SearchAllIamPoliciesExample.java) |
| Search All Resources Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/SearchAllResourcesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/SearchAllResourcesExample.java) |
| Update Feed Example | [source code](https://github.com/googleapis/java-asset/blob/master/samples/snippets/src/main/java/com/example/asset/UpdateFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/UpdateFeedExample.java) |



## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
* <pre>
* <code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(name);
* String parent = "";
* Feed response = assetServiceClient.createFeed(parent);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -170,98 +170,6 @@ public final OperationsClient getOperationsClient() {
return operationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(name);
* }
* </code></pre>
*
* @param 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_id
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteFeed(FeedName name) {
DeleteFeedRequest request =
DeleteFeedRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteFeed(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(name.toString());
* }
* </code></pre>
*
* @param 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_id
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteFeed(String name) {
DeleteFeedRequest request = DeleteFeedRequest.newBuilder().setName(name).build();
deleteFeed(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
* .setName(name.toString())
* .build();
* assetServiceClient.deleteFeed(request);
* }
* </code></pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteFeed(DeleteFeedRequest request) {
deleteFeedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
* .setName(name.toString())
* .build();
* ApiFuture&lt;Void&gt; future = assetServiceClient.deleteFeedCallable().futureCall(request);
* // Do something
* future.get();
* }
* </code></pre>
*/
public final UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
return stub.deleteFeedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Exports assets with time and resource types to a given Cloud Storage location/BigQuery table.
Expand Down Expand Up @@ -725,6 +633,98 @@ public final UnaryCallable<UpdateFeedRequest, Feed> updateFeedCallable() {
return stub.updateFeedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(name);
* }
* </code></pre>
*
* @param 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_id
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteFeed(FeedName name) {
DeleteFeedRequest request =
DeleteFeedRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteFeed(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(name.toString());
* }
* </code></pre>
*
* @param 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_id
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteFeed(String name) {
DeleteFeedRequest request = DeleteFeedRequest.newBuilder().setName(name).build();
deleteFeed(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
* .setName(name.toString())
* .build();
* assetServiceClient.deleteFeed(request);
* }
* </code></pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteFeed(DeleteFeedRequest request) {
deleteFeedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
* .setName(name.toString())
* .build();
* ApiFuture&lt;Void&gt; future = assetServiceClient.deleteFeedCallable().futureCall(request);
* // Do something
* future.get();
* }
* </code></pre>
*/
public final UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
return stub.deleteFeedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Searches all the resources within the given accessible scope (e.g., a project, a folder or an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of deleteFeed to 30 seconds:
* <p>For example, to set the total timeout of createFeed to 30 seconds:
*
* <pre>
* <code>
* AssetServiceSettings.Builder assetServiceSettingsBuilder =
* AssetServiceSettings.newBuilder();
* assetServiceSettingsBuilder
* .deleteFeedSettings()
* .createFeedSettings()
* .setRetrySettings(
* assetServiceSettingsBuilder.deleteFeedSettings().getRetrySettings().toBuilder()
* assetServiceSettingsBuilder.createFeedSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AssetServiceSettings assetServiceSettings = assetServiceSettingsBuilder.build();
Expand All @@ -71,11 +71,6 @@
@Generated("by gapic-generator")
@BetaApi
public class AssetServiceSettings extends ClientSettings<AssetServiceSettings> {
/** Returns the object with the settings used for calls to deleteFeed. */
public UnaryCallSettings<DeleteFeedRequest, Empty> deleteFeedSettings() {
return ((AssetServiceStubSettings) getStubSettings()).deleteFeedSettings();
}

/** Returns the object with the settings used for calls to exportAssets. */
public UnaryCallSettings<ExportAssetsRequest, Operation> exportAssetsSettings() {
return ((AssetServiceStubSettings) getStubSettings()).exportAssetsSettings();
Expand Down Expand Up @@ -115,6 +110,11 @@ public UnaryCallSettings<UpdateFeedRequest, Feed> updateFeedSettings() {
return ((AssetServiceStubSettings) getStubSettings()).updateFeedSettings();
}

/** Returns the object with the settings used for calls to deleteFeed. */
public UnaryCallSettings<DeleteFeedRequest, Empty> deleteFeedSettings() {
return ((AssetServiceStubSettings) getStubSettings()).deleteFeedSettings();
}

/** Returns the object with the settings used for calls to searchAllResources. */
public PagedCallSettings<
SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse>
Expand Down Expand Up @@ -228,11 +228,6 @@ public Builder applyToAllUnaryMethods(
return this;
}

/** Returns the builder for the settings used for calls to deleteFeed. */
public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings() {
return getStubSettingsBuilder().deleteFeedSettings();
}

/** Returns the builder for the settings used for calls to exportAssets. */
public UnaryCallSettings.Builder<ExportAssetsRequest, Operation> exportAssetsSettings() {
return getStubSettingsBuilder().exportAssetsSettings();
Expand Down Expand Up @@ -273,6 +268,11 @@ public UnaryCallSettings.Builder<UpdateFeedRequest, Feed> updateFeedSettings() {
return getStubSettingsBuilder().updateFeedSettings();
}

/** Returns the builder for the settings used for calls to deleteFeed. */
public UnaryCallSettings.Builder<DeleteFeedRequest, Empty> deleteFeedSettings() {
return getStubSettingsBuilder().deleteFeedSettings();
}

/** Returns the builder for the settings used for calls to searchAllResources. */
public PagedCallSettings.Builder<
SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* <pre>
* <code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(name);
* String parent = "";
* Feed response = assetServiceClient.createFeed(parent);
* }
* </code>
* </pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
}

public UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
throw new UnsupportedOperationException("Not implemented: deleteFeedCallable()");
}

@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable<ExportAssetsRequest, ExportAssetsResponse, ExportAssetsRequest>
exportAssetsOperationCallable() {
Expand Down Expand Up @@ -92,6 +88,10 @@ public UnaryCallable<UpdateFeedRequest, Feed> updateFeedCallable() {
throw new UnsupportedOperationException("Not implemented: updateFeedCallable()");
}

public UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
throw new UnsupportedOperationException("Not implemented: deleteFeedCallable()");
}

public UnaryCallable<SearchAllResourcesRequest, SearchAllResourcesPagedResponse>
searchAllResourcesPagedCallable() {
throw new UnsupportedOperationException("Not implemented: searchAllResourcesPagedCallable()");
Expand Down
Loading