Skip to content
Permalink
Browse files
feat(regen): removes deprecated FeedName methods from v1p2beta1 client (
#157)

* chore: enable gapicv2 for asset/v1p2beta1 API

Committer: @miraleung
PiperOrigin-RevId: 306281797

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Apr 13 12:09:03 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 0feb08065d91d6deebffef3019751f0619a72140
Source-Link: googleapis/googleapis@0feb080

* chore: enable gapicv2 for asset/v1p4beta1  API

Committer: @miraleung
PiperOrigin-RevId: 306282838

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Apr 13 12:13:42 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 4efd71279f0781579ced60c374336ce1b8b8cea8
Source-Link: googleapis/googleapis@4efd712

* chore: enable gapicv2 for asset/v1beta1 API

Committer: @miraleung
PiperOrigin-RevId: 306283252

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Apr 13 12:15:47 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: a34f4eb96a94bfd5b3e7f8de253db28d0a3e9237
Source-Link: googleapis/googleapis@a34f4eb

* chore: allow breaking change to v1p2beta1 client

Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
yoshi-automation and chingor13 committed Apr 20, 2020
1 parent ec7e53d commit 6de4ad03536cc94539d99794cb27671fe6b1aee9
Showing with 656 additions and 485 deletions.
  1. +9 −0 google-cloud-asset/clirr-ignored-differences.xml
  2. +6 −18 google-cloud-asset/src/main/java/com/google/cloud/asset/v1beta1/AssetServiceClient.java
  3. +1 −5 google-cloud-asset/src/main/java/com/google/cloud/asset/v1beta1/package-info.java
  4. +124 −114 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceClient.java
  5. +13 −13 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceSettings.java
  6. +2 −2 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/package-info.java
  7. +4 −4 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/stub/AssetServiceStub.java
  8. +28 −28 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/stub/AssetServiceStubSettings.java
  9. +28 −28 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/stub/GrpcAssetServiceStub.java
  10. +50 −50 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/AssetServiceClient.java
  11. +12 −12 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/AssetServiceSettings.java
  12. +5 −5 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/stub/AssetServiceStub.java
  13. +26 −26 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/stub/AssetServiceStubSettings.java
  14. +32 −32 google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/stub/GrpcAssetServiceStub.java
  15. +9 −22 google-cloud-asset/src/test/java/com/google/cloud/asset/v1beta1/AssetServiceClientTest.java
  16. +48 −48 google-cloud-asset/src/test/java/com/google/cloud/asset/v1p2beta1/AssetServiceClientTest.java
  17. +44 −44 google-cloud-asset/src/test/java/com/google/cloud/asset/v1p4beta1/AssetServiceClientTest.java
  18. +205 −24 proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/FeedName.java
  19. +10 −10 synth.metadata
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<difference>
<differenceType>7002</differenceType>
<className>com/google/cloud/asset/v1p2beta1/AssetServiceClient</className>
<method>java.lang.String *FeedName(*)</method>
</difference>
</differences>
@@ -38,13 +38,9 @@
* <pre>
* <code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
* String parent = "";
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
* .setParent(parent.toString())
* .setContentType(contentType)
* .setReadTimeWindow(readTimeWindow)
* .build();
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
* }
@@ -178,7 +174,7 @@ public final OperationsClient getOperationsClient() {
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* String parent = "";
* OutputConfig outputConfig = OutputConfig.newBuilder().build();
* ExportAssetsRequest request = ExportAssetsRequest.newBuilder()
* .setParent(parent.toString())
@@ -209,7 +205,7 @@ public final OperationFuture<ExportAssetsResponse, ExportAssetsRequest> exportAs
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* String parent = "";
* OutputConfig outputConfig = OutputConfig.newBuilder().build();
* ExportAssetsRequest request = ExportAssetsRequest.newBuilder()
* .setParent(parent.toString())
@@ -238,7 +234,7 @@ public final OperationFuture<ExportAssetsResponse, ExportAssetsRequest> exportAs
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* String parent = "";
* OutputConfig outputConfig = OutputConfig.newBuilder().build();
* ExportAssetsRequest request = ExportAssetsRequest.newBuilder()
* .setParent(parent.toString())
@@ -266,13 +262,9 @@ public final UnaryCallable<ExportAssetsRequest, Operation> exportAssetsCallable(
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
* String parent = "";
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
* .setParent(parent.toString())
* .setContentType(contentType)
* .setReadTimeWindow(readTimeWindow)
* .build();
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
* }
@@ -298,13 +290,9 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
* String parent = "";
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
* .setParent(parent.toString())
* .setContentType(contentType)
* .setReadTimeWindow(readTimeWindow)
* .build();
* ApiFuture&lt;BatchGetAssetsHistoryResponse&gt; future = assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request);
* // Do something
@@ -28,13 +28,9 @@
* <pre>
* <code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
* String parent = "";
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
* .setParent(parent.toString())
* .setContentType(contentType)
* .setReadTimeWindow(readTimeWindow)
* .build();
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
* }
@@ -18,7 +18,6 @@
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.api.pathtemplate.PathTemplate;
import com.google.cloud.asset.v1p2beta1.stub.AssetServiceStub;
import com.google.cloud.asset.v1p2beta1.stub.AssetServiceStubSettings;
import com.google.protobuf.Empty;
@@ -36,8 +35,8 @@
* <pre>
* <code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String parent = "";
* Feed response = assetServiceClient.createFeed(parent);
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(name);
* }
* </code>
* </pre>
@@ -98,41 +97,6 @@ public class AssetServiceClient implements BackgroundResource {
private final AssetServiceSettings settings;
private final AssetServiceStub stub;

private static final PathTemplate FEED_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}/feeds/{feed}");

/**
* Formats a string containing the fully-qualified path to represent a feed resource.
*
* @deprecated Use the {@link FeedName} class instead.
*/
@Deprecated
public static final String formatFeedName(String project, String feed) {
return FEED_PATH_TEMPLATE.instantiate(
"project", project,
"feed", feed);
}

/**
* Parses the project from the given fully-qualified path which represents a feed resource.
*
* @deprecated Use the {@link FeedName} class instead.
*/
@Deprecated
public static final String parseProjectFromFeedName(String feedName) {
return FEED_PATH_TEMPLATE.parse(feedName).get("project");
}

/**
* Parses the feed from the given fully-qualified path which represents a feed resource.
*
* @deprecated Use the {@link FeedName} class instead.
*/
@Deprecated
public static final String parseFeedFromFeedName(String feedName) {
return FEED_PATH_TEMPLATE.parse(feedName).get("feed");
}

/** Constructs an instance of AssetServiceClient with default settings. */
public static final AssetServiceClient create() throws IOException {
return create(AssetServiceSettings.newBuilder().build());
@@ -180,6 +144,98 @@ public AssetServiceStub getStub() {
return stub;
}

// 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
/**
* Creates a feed in a parent project/folder/organization to listen to its asset updates.
@@ -265,8 +321,32 @@ public final UnaryCallable<CreateFeedRequest, Feed> createFeedCallable() {
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
* Feed response = assetServiceClient.getFeed(formattedName);
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* Feed response = assetServiceClient.getFeed(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 Feed getFeed(FeedName name) {
GetFeedRequest request =
GetFeedRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getFeed(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets details about an asset feed.
*
* <p>Sample code:
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* Feed response = assetServiceClient.getFeed(name.toString());
* }
* </code></pre>
*
@@ -276,7 +356,6 @@ public final UnaryCallable<CreateFeedRequest, Feed> createFeedCallable() {
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Feed getFeed(String name) {
FEED_PATH_TEMPLATE.validate(name, "getFeed");
GetFeedRequest request = GetFeedRequest.newBuilder().setName(name).build();
return getFeed(request);
}
@@ -289,9 +368,9 @@ public final Feed getFeed(String name) {
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* GetFeedRequest request = GetFeedRequest.newBuilder()
* .setName(formattedName)
* .setName(name.toString())
* .build();
* Feed response = assetServiceClient.getFeed(request);
* }
@@ -312,9 +391,9 @@ public final Feed getFeed(GetFeedRequest request) {
*
* <pre><code>
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
* GetFeedRequest request = GetFeedRequest.newBuilder()
* .setName(formattedName)
* .setName(name.toString())
* .build();
* ApiFuture&lt;Feed&gt; future = assetServiceClient.getFeedCallable().futureCall(request);
* // Do something
@@ -466,75 +545,6 @@ 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()) {
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
* assetServiceClient.deleteFeed(formattedName);
* }
* </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) {
FEED_PATH_TEMPLATE.validate(name, "deleteFeed");
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()) {
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
* .setName(formattedName)
* .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()) {
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
* .setName(formattedName)
* .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();
}

@Override
public final void close() {
stub.close();

0 comments on commit 6de4ad0

Please sign in to comment.