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

Commit

Permalink
feat(regen): removes deprecated FeedName methods from v1p2beta1 client (
Browse files Browse the repository at this point in the history
#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 authored Apr 20, 2020
1 parent ec7e53d commit 6de4ad0
Show file tree
Hide file tree
Showing 19 changed files with 656 additions and 485 deletions.
9 changes: 9 additions & 0 deletions google-cloud-asset/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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);
* }
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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);
* }
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
* }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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>
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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>
*
Expand All @@ -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);
}
Expand All @@ -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);
* }
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 6de4ad0

Please sign in to comment.