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

Commit 6de4ad0

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>
1 parent ec7e53d commit 6de4ad0

File tree

19 files changed

+656
-485
lines changed

19 files changed

+656
-485
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
3+
<differences>
4+
<difference>
5+
<differenceType>7002</differenceType>
6+
<className>com/google/cloud/asset/v1p2beta1/AssetServiceClient</className>
7+
<method>java.lang.String *FeedName(*)</method>
8+
</difference>
9+
</differences>

google-cloud-asset/src/main/java/com/google/cloud/asset/v1beta1/AssetServiceClient.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@
3838
* <pre>
3939
* <code>
4040
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
41-
* ProjectName parent = ProjectName.of("[PROJECT]");
42-
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
43-
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
41+
* String parent = "";
4442
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
4543
* .setParent(parent.toString())
46-
* .setContentType(contentType)
47-
* .setReadTimeWindow(readTimeWindow)
4844
* .build();
4945
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
5046
* }
@@ -178,7 +174,7 @@ public final OperationsClient getOperationsClient() {
178174
*
179175
* <pre><code>
180176
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
181-
* ProjectName parent = ProjectName.of("[PROJECT]");
177+
* String parent = "";
182178
* OutputConfig outputConfig = OutputConfig.newBuilder().build();
183179
* ExportAssetsRequest request = ExportAssetsRequest.newBuilder()
184180
* .setParent(parent.toString())
@@ -209,7 +205,7 @@ public final OperationFuture<ExportAssetsResponse, ExportAssetsRequest> exportAs
209205
*
210206
* <pre><code>
211207
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
212-
* ProjectName parent = ProjectName.of("[PROJECT]");
208+
* String parent = "";
213209
* OutputConfig outputConfig = OutputConfig.newBuilder().build();
214210
* ExportAssetsRequest request = ExportAssetsRequest.newBuilder()
215211
* .setParent(parent.toString())
@@ -238,7 +234,7 @@ public final OperationFuture<ExportAssetsResponse, ExportAssetsRequest> exportAs
238234
*
239235
* <pre><code>
240236
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
241-
* ProjectName parent = ProjectName.of("[PROJECT]");
237+
* String parent = "";
242238
* OutputConfig outputConfig = OutputConfig.newBuilder().build();
243239
* ExportAssetsRequest request = ExportAssetsRequest.newBuilder()
244240
* .setParent(parent.toString())
@@ -266,13 +262,9 @@ public final UnaryCallable<ExportAssetsRequest, Operation> exportAssetsCallable(
266262
*
267263
* <pre><code>
268264
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
269-
* ProjectName parent = ProjectName.of("[PROJECT]");
270-
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
271-
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
265+
* String parent = "";
272266
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
273267
* .setParent(parent.toString())
274-
* .setContentType(contentType)
275-
* .setReadTimeWindow(readTimeWindow)
276268
* .build();
277269
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
278270
* }
@@ -298,13 +290,9 @@ public final BatchGetAssetsHistoryResponse batchGetAssetsHistory(
298290
*
299291
* <pre><code>
300292
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
301-
* ProjectName parent = ProjectName.of("[PROJECT]");
302-
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
303-
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
293+
* String parent = "";
304294
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
305295
* .setParent(parent.toString())
306-
* .setContentType(contentType)
307-
* .setReadTimeWindow(readTimeWindow)
308296
* .build();
309297
* ApiFuture&lt;BatchGetAssetsHistoryResponse&gt; future = assetServiceClient.batchGetAssetsHistoryCallable().futureCall(request);
310298
* // Do something

google-cloud-asset/src/main/java/com/google/cloud/asset/v1beta1/package-info.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@
2828
* <pre>
2929
* <code>
3030
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
31-
* ProjectName parent = ProjectName.of("[PROJECT]");
32-
* ContentType contentType = ContentType.CONTENT_TYPE_UNSPECIFIED;
33-
* TimeWindow readTimeWindow = TimeWindow.newBuilder().build();
31+
* String parent = "";
3432
* BatchGetAssetsHistoryRequest request = BatchGetAssetsHistoryRequest.newBuilder()
3533
* .setParent(parent.toString())
36-
* .setContentType(contentType)
37-
* .setReadTimeWindow(readTimeWindow)
3834
* .build();
3935
* BatchGetAssetsHistoryResponse response = assetServiceClient.batchGetAssetsHistory(request);
4036
* }

google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceClient.java

Lines changed: 124 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import com.google.api.core.BetaApi;
1919
import com.google.api.gax.core.BackgroundResource;
2020
import com.google.api.gax.rpc.UnaryCallable;
21-
import com.google.api.pathtemplate.PathTemplate;
2221
import com.google.cloud.asset.v1p2beta1.stub.AssetServiceStub;
2322
import com.google.cloud.asset.v1p2beta1.stub.AssetServiceStubSettings;
2423
import com.google.protobuf.Empty;
@@ -36,8 +35,8 @@
3635
* <pre>
3736
* <code>
3837
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
39-
* String parent = "";
40-
* Feed response = assetServiceClient.createFeed(parent);
38+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
39+
* assetServiceClient.deleteFeed(name);
4140
* }
4241
* </code>
4342
* </pre>
@@ -98,41 +97,6 @@ public class AssetServiceClient implements BackgroundResource {
9897
private final AssetServiceSettings settings;
9998
private final AssetServiceStub stub;
10099

101-
private static final PathTemplate FEED_PATH_TEMPLATE =
102-
PathTemplate.createWithoutUrlEncoding("projects/{project}/feeds/{feed}");
103-
104-
/**
105-
* Formats a string containing the fully-qualified path to represent a feed resource.
106-
*
107-
* @deprecated Use the {@link FeedName} class instead.
108-
*/
109-
@Deprecated
110-
public static final String formatFeedName(String project, String feed) {
111-
return FEED_PATH_TEMPLATE.instantiate(
112-
"project", project,
113-
"feed", feed);
114-
}
115-
116-
/**
117-
* Parses the project from the given fully-qualified path which represents a feed resource.
118-
*
119-
* @deprecated Use the {@link FeedName} class instead.
120-
*/
121-
@Deprecated
122-
public static final String parseProjectFromFeedName(String feedName) {
123-
return FEED_PATH_TEMPLATE.parse(feedName).get("project");
124-
}
125-
126-
/**
127-
* Parses the feed from the given fully-qualified path which represents a feed resource.
128-
*
129-
* @deprecated Use the {@link FeedName} class instead.
130-
*/
131-
@Deprecated
132-
public static final String parseFeedFromFeedName(String feedName) {
133-
return FEED_PATH_TEMPLATE.parse(feedName).get("feed");
134-
}
135-
136100
/** Constructs an instance of AssetServiceClient with default settings. */
137101
public static final AssetServiceClient create() throws IOException {
138102
return create(AssetServiceSettings.newBuilder().build());
@@ -180,6 +144,98 @@ public AssetServiceStub getStub() {
180144
return stub;
181145
}
182146

147+
// AUTO-GENERATED DOCUMENTATION AND METHOD
148+
/**
149+
* Deletes an asset feed.
150+
*
151+
* <p>Sample code:
152+
*
153+
* <pre><code>
154+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
155+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
156+
* assetServiceClient.deleteFeed(name);
157+
* }
158+
* </code></pre>
159+
*
160+
* @param name Required. The name of the feed and it must be in the format of:
161+
* projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
162+
* organizations/organization_number/feeds/feed_id
163+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
164+
*/
165+
public final void deleteFeed(FeedName name) {
166+
DeleteFeedRequest request =
167+
DeleteFeedRequest.newBuilder().setName(name == null ? null : name.toString()).build();
168+
deleteFeed(request);
169+
}
170+
171+
// AUTO-GENERATED DOCUMENTATION AND METHOD
172+
/**
173+
* Deletes an asset feed.
174+
*
175+
* <p>Sample code:
176+
*
177+
* <pre><code>
178+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
179+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
180+
* assetServiceClient.deleteFeed(name.toString());
181+
* }
182+
* </code></pre>
183+
*
184+
* @param name Required. The name of the feed and it must be in the format of:
185+
* projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
186+
* organizations/organization_number/feeds/feed_id
187+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
188+
*/
189+
public final void deleteFeed(String name) {
190+
DeleteFeedRequest request = DeleteFeedRequest.newBuilder().setName(name).build();
191+
deleteFeed(request);
192+
}
193+
194+
// AUTO-GENERATED DOCUMENTATION AND METHOD
195+
/**
196+
* Deletes an asset feed.
197+
*
198+
* <p>Sample code:
199+
*
200+
* <pre><code>
201+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
202+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
203+
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
204+
* .setName(name.toString())
205+
* .build();
206+
* assetServiceClient.deleteFeed(request);
207+
* }
208+
* </code></pre>
209+
*
210+
* @param request The request object containing all of the parameters for the API call.
211+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
212+
*/
213+
public final void deleteFeed(DeleteFeedRequest request) {
214+
deleteFeedCallable().call(request);
215+
}
216+
217+
// AUTO-GENERATED DOCUMENTATION AND METHOD
218+
/**
219+
* Deletes an asset feed.
220+
*
221+
* <p>Sample code:
222+
*
223+
* <pre><code>
224+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
225+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
226+
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
227+
* .setName(name.toString())
228+
* .build();
229+
* ApiFuture&lt;Void&gt; future = assetServiceClient.deleteFeedCallable().futureCall(request);
230+
* // Do something
231+
* future.get();
232+
* }
233+
* </code></pre>
234+
*/
235+
public final UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
236+
return stub.deleteFeedCallable();
237+
}
238+
183239
// AUTO-GENERATED DOCUMENTATION AND METHOD
184240
/**
185241
* 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() {
265321
*
266322
* <pre><code>
267323
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
268-
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
269-
* Feed response = assetServiceClient.getFeed(formattedName);
324+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
325+
* Feed response = assetServiceClient.getFeed(name);
326+
* }
327+
* </code></pre>
328+
*
329+
* @param name Required. The name of the Feed and it must be in the format of:
330+
* projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
331+
* organizations/organization_number/feeds/feed_id
332+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
333+
*/
334+
public final Feed getFeed(FeedName name) {
335+
GetFeedRequest request =
336+
GetFeedRequest.newBuilder().setName(name == null ? null : name.toString()).build();
337+
return getFeed(request);
338+
}
339+
340+
// AUTO-GENERATED DOCUMENTATION AND METHOD
341+
/**
342+
* Gets details about an asset feed.
343+
*
344+
* <p>Sample code:
345+
*
346+
* <pre><code>
347+
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
348+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
349+
* Feed response = assetServiceClient.getFeed(name.toString());
270350
* }
271351
* </code></pre>
272352
*
@@ -276,7 +356,6 @@ public final UnaryCallable<CreateFeedRequest, Feed> createFeedCallable() {
276356
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
277357
*/
278358
public final Feed getFeed(String name) {
279-
FEED_PATH_TEMPLATE.validate(name, "getFeed");
280359
GetFeedRequest request = GetFeedRequest.newBuilder().setName(name).build();
281360
return getFeed(request);
282361
}
@@ -289,9 +368,9 @@ public final Feed getFeed(String name) {
289368
*
290369
* <pre><code>
291370
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
292-
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
371+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
293372
* GetFeedRequest request = GetFeedRequest.newBuilder()
294-
* .setName(formattedName)
373+
* .setName(name.toString())
295374
* .build();
296375
* Feed response = assetServiceClient.getFeed(request);
297376
* }
@@ -312,9 +391,9 @@ public final Feed getFeed(GetFeedRequest request) {
312391
*
313392
* <pre><code>
314393
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
315-
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
394+
* FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]");
316395
* GetFeedRequest request = GetFeedRequest.newBuilder()
317-
* .setName(formattedName)
396+
* .setName(name.toString())
318397
* .build();
319398
* ApiFuture&lt;Feed&gt; future = assetServiceClient.getFeedCallable().futureCall(request);
320399
* // Do something
@@ -466,75 +545,6 @@ public final UnaryCallable<UpdateFeedRequest, Feed> updateFeedCallable() {
466545
return stub.updateFeedCallable();
467546
}
468547

469-
// AUTO-GENERATED DOCUMENTATION AND METHOD
470-
/**
471-
* Deletes an asset feed.
472-
*
473-
* <p>Sample code:
474-
*
475-
* <pre><code>
476-
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
477-
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
478-
* assetServiceClient.deleteFeed(formattedName);
479-
* }
480-
* </code></pre>
481-
*
482-
* @param name Required. The name of the feed and it must be in the format of:
483-
* projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id
484-
* organizations/organization_number/feeds/feed_id
485-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
486-
*/
487-
public final void deleteFeed(String name) {
488-
FEED_PATH_TEMPLATE.validate(name, "deleteFeed");
489-
DeleteFeedRequest request = DeleteFeedRequest.newBuilder().setName(name).build();
490-
deleteFeed(request);
491-
}
492-
493-
// AUTO-GENERATED DOCUMENTATION AND METHOD
494-
/**
495-
* Deletes an asset feed.
496-
*
497-
* <p>Sample code:
498-
*
499-
* <pre><code>
500-
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
501-
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
502-
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
503-
* .setName(formattedName)
504-
* .build();
505-
* assetServiceClient.deleteFeed(request);
506-
* }
507-
* </code></pre>
508-
*
509-
* @param request The request object containing all of the parameters for the API call.
510-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
511-
*/
512-
public final void deleteFeed(DeleteFeedRequest request) {
513-
deleteFeedCallable().call(request);
514-
}
515-
516-
// AUTO-GENERATED DOCUMENTATION AND METHOD
517-
/**
518-
* Deletes an asset feed.
519-
*
520-
* <p>Sample code:
521-
*
522-
* <pre><code>
523-
* try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
524-
* String formattedName = AssetServiceClient.formatFeedName("[PROJECT]", "[FEED]");
525-
* DeleteFeedRequest request = DeleteFeedRequest.newBuilder()
526-
* .setName(formattedName)
527-
* .build();
528-
* ApiFuture&lt;Void&gt; future = assetServiceClient.deleteFeedCallable().futureCall(request);
529-
* // Do something
530-
* future.get();
531-
* }
532-
* </code></pre>
533-
*/
534-
public final UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() {
535-
return stub.deleteFeedCallable();
536-
}
537-
538548
@Override
539549
public final void close() {
540550
stub.close();

0 commit comments

Comments
 (0)