Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit 1214ae5

Browse files
committed
Merge branch 'master' into gapic_config_v2
2 parents 280e279 + 12d3d62 commit 1214ae5

File tree

10 files changed

+2
-79
lines changed

10 files changed

+2
-79
lines changed

src/main/java/com/google/api/codegen/config/LongRunningConfig.java

-12
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
public abstract class LongRunningConfig {
3333

3434
// Default values for LongRunningConfig fields.
35-
static final boolean LRO_IMPLEMENTS_CANCEL = true;
36-
static final boolean LRO_IMPLEMENTS_DELETE = true;
3735
static final int LRO_INITIAL_POLL_DELAY_MILLIS = 500;
3836
static final double LRO_POLL_DELAY_MULTIPLIER = 1.5;
3937
static final int LRO_MAX_POLL_DELAY_MILLIS = 5000;
@@ -45,12 +43,6 @@ public abstract class LongRunningConfig {
4543
/** Returns the message type for the metadata field of an operation. */
4644
public abstract TypeModel getMetadataType();
4745

48-
/** Reports whether or not the service implements delete. */
49-
public abstract boolean implementsDelete();
50-
51-
/** Reports whether or not the service implements cancel. */
52-
public abstract boolean implementsCancel();
53-
5446
/** Returns initial delay after which first poll request will be made. */
5547
public abstract Duration getInitialPollDelay();
5648

@@ -168,8 +160,6 @@ private static LongRunningConfig createLongRunningConfigFromProtoFile(
168160
return new AutoValue_LongRunningConfig(
169161
ProtoTypeRef.create(returnType),
170162
ProtoTypeRef.create(metadataType),
171-
LRO_IMPLEMENTS_CANCEL,
172-
LRO_IMPLEMENTS_DELETE,
173163
initialPollDelay,
174164
LRO_POLL_DELAY_MULTIPLIER,
175165
maxPollDelay,
@@ -260,8 +250,6 @@ private static LongRunningConfig createLongRunningConfigFromGapicConfig(
260250
return new AutoValue_LongRunningConfig(
261251
ProtoTypeRef.create(returnType),
262252
ProtoTypeRef.create(metadataType),
263-
longRunningConfigProto.getImplementsDelete(),
264-
longRunningConfigProto.getImplementsCancel(),
265253
initialPollDelay,
266254
pollDelayMultiplier,
267255
maxPollDelay,

src/main/java/com/google/api/codegen/transformer/LongRunningTransformer.java

-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ LongRunningOperationDetailView generateDetailView(MethodContext context) {
4141
.isEmptyOperation(lroConfig.getReturnType().isEmptyType())
4242
.isEmptyMetadata(lroConfig.getMetadataType().isEmptyType())
4343
.metadataTypeName(metadataTypeName)
44-
.implementsDelete(lroConfig.implementsDelete())
45-
.implementsCancel(lroConfig.implementsCancel())
4644
.initialPollDelay(lroConfig.getInitialPollDelay().toMillis())
4745
.pollDelayMultiplier(lroConfig.getPollDelayMultiplier())
4846
.maxPollDelay(lroConfig.getMaxPollDelay().toMillis())

src/main/java/com/google/api/codegen/transformer/nodejs/NodeJSGapicSurfaceTransformer.java

-2
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ private List<LongRunningOperationDetailView> createLongRunningDescriptors(
237237
.isEmptyOperation(lroConfig.getReturnType().isEmptyType())
238238
.isEmptyMetadata(lroConfig.getMetadataType().isEmptyType())
239239
.metadataTypeName(context.getImportTypeTable().getFullNameFor(metadataType))
240-
.implementsCancel(true)
241-
.implementsDelete(true)
242240
.initialPollDelay(lroConfig.getInitialPollDelay().toMillis())
243241
.pollDelayMultiplier(lroConfig.getPollDelayMultiplier())
244242
.maxPollDelay(lroConfig.getMaxPollDelay().toMillis())

src/main/java/com/google/api/codegen/transformer/php/PhpGapicSurfaceTransformer.java

-2
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ private List<LongRunningOperationDetailView> createLongRunningDescriptors(
259259
.isEmptyOperation(lroConfig.getReturnType().isEmptyType())
260260
.isEmptyMetadata(lroConfig.getMetadataType().isEmptyType())
261261
.metadataTypeName(context.getImportTypeTable().getFullNameFor(metadataType))
262-
.implementsCancel(true)
263-
.implementsDelete(true)
264262
.initialPollDelay(lroConfig.getInitialPollDelay().toMillis())
265263
.pollDelayMultiplier(lroConfig.getPollDelayMultiplier())
266264
.maxPollDelay(lroConfig.getMaxPollDelay().toMillis())

src/main/java/com/google/api/codegen/viewmodel/LongRunningOperationDetailView.java

-8
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ public abstract class LongRunningOperationDetailView {
3232

3333
public abstract String metadataTypeName();
3434

35-
public abstract boolean implementsDelete();
36-
37-
public abstract boolean implementsCancel();
38-
3935
public abstract String methodName();
4036

4137
@Nullable
@@ -67,10 +63,6 @@ public abstract static class Builder {
6763

6864
public abstract Builder metadataTypeName(String val);
6965

70-
public abstract Builder implementsDelete(boolean val);
71-
72-
public abstract Builder implementsCancel(boolean val);
73-
7466
public abstract Builder methodName(String val);
7567

7668
public abstract Builder transportMethodName(String val);

src/main/proto/com/google/api/codegen/config.proto

+2-2
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,10 @@ message LongRunningConfigProto {
667667
string metadata_type = 2;
668668

669669
// Whether or not the server implements delete.
670-
bool implements_delete = 3;
670+
bool implements_delete = 3; // DEPRECATED.
671671

672672
// Whether or not the server implements cancel.
673-
bool implements_cancel = 4;
673+
bool implements_cancel = 4; // DEPRECATED.
674674

675675
// Initial delay after which first poll request will be made.
676676
uint64 initial_poll_delay_millis = 5;

src/main/resources/com/google/api/codegen/go/main.snip

-19
Original file line numberDiff line numberDiff line change
@@ -407,25 +407,6 @@
407407
return op.lro.Name()
408408
}
409409

410-
@if lro.implementsCancel
411-
// Cancel starts asynchronous cancellation on a long-running operation.
412-
// The server makes a best effort to cancel the operation, but success is not guaranteed.
413-
// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation
414-
// completed despite cancellation. On successful cancellation, the operation is not deleted;
415-
// instead, op.Poll returns an error with code Canceled.
416-
func (op *{@lro.clientReturnTypeName}) Cancel(ctx context.Context, opts ...gax.CallOption) error {
417-
return op.lro.Cancel(ctx, opts...)
418-
}
419-
@end
420-
421-
@if lro.implementsDelete
422-
// Delete deletes a long-running operation.
423-
// This method indicates that the client is no longer interested in the operation result.
424-
// It does not cancel the operation.
425-
func (op *{@lro.clientReturnTypeName}) Delete(ctx context.Context, opts ...gax.CallOption) error {
426-
return op.lro.Delete(ctx, opts...)
427-
}
428-
@end
429410
@end
430411

431412
@private pollMetadataDoc(lro)

src/test/java/com/google/api/codegen/config/LongRunningConfigTest.java

-14
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ public class LongRunningConfigTest {
7070
private static final LongRunningConfigProto lroConfigProtoWithPollSettings =
7171
baseLroConfigProto
7272
.toBuilder()
73-
.setImplementsCancel(TEST_IMPLEMENTS_CANCEL)
74-
.setImplementsDelete(TEST_IMPLEMENTS_DELETE)
7573
.setInitialPollDelayMillis(TEST_INITIAL_POLL_DELAY)
7674
.setPollDelayMultiplier(TEST_POLL_DELAY_MULTIPLIER)
7775
.setMaxPollDelayMillis(TEST_MAX_POLL_DELAY)
@@ -130,10 +128,6 @@ public void testCreateLROWithoutGapicConfig() {
130128
.isEqualTo(LongRunningConfig.LRO_POLL_DELAY_MULTIPLIER);
131129
assertThat(longRunningConfig.getTotalPollTimeout().toMillis())
132130
.isEqualTo(LongRunningConfig.LRO_TOTAL_POLL_TIMEOUT_MILLS);
133-
assertThat(longRunningConfig.implementsCancel())
134-
.isEqualTo(LongRunningConfig.LRO_IMPLEMENTS_CANCEL);
135-
assertThat(longRunningConfig.implementsDelete())
136-
.isEqualTo(LongRunningConfig.LRO_IMPLEMENTS_DELETE);
137131
}
138132

139133
@Test
@@ -161,8 +155,6 @@ public void testCreateLROWithGapicConfigOnly() {
161155
assertThat(longRunningConfig.getPollDelayMultiplier()).isEqualTo(TEST_POLL_DELAY_MULTIPLIER);
162156
assertThat(longRunningConfig.getTotalPollTimeout().toMillis())
163157
.isEqualTo(TEST_TOTAL_POLL_TIMEOUT);
164-
assertThat(longRunningConfig.implementsCancel()).isEqualTo(TEST_IMPLEMENTS_CANCEL);
165-
assertThat(longRunningConfig.implementsDelete()).isEqualTo(TEST_IMPLEMENTS_DELETE);
166158
}
167159

168160
@Test
@@ -191,10 +183,6 @@ public void testCreateLROWithAnnotationsOverridingGapicConfig() {
191183
.isEqualTo(LongRunningConfig.LRO_POLL_DELAY_MULTIPLIER);
192184
assertThat(longRunningConfig.getTotalPollTimeout().toMillis())
193185
.isEqualTo(LongRunningConfig.LRO_TOTAL_POLL_TIMEOUT_MILLS);
194-
assertThat(longRunningConfig.implementsCancel())
195-
.isEqualTo(LongRunningConfig.LRO_IMPLEMENTS_CANCEL);
196-
assertThat(longRunningConfig.implementsDelete())
197-
.isEqualTo(LongRunningConfig.LRO_IMPLEMENTS_DELETE);
198186
}
199187

200188
@Test
@@ -229,8 +217,6 @@ public void testCreateSameLROFromProtoFileAndGapicConfig() {
229217
assertThat(longRunningConfig.getPollDelayMultiplier()).isEqualTo(TEST_POLL_DELAY_MULTIPLIER);
230218
assertThat(longRunningConfig.getTotalPollTimeout().toMillis())
231219
.isEqualTo(TEST_TOTAL_POLL_TIMEOUT);
232-
assertThat(longRunningConfig.implementsCancel()).isEqualTo(TEST_IMPLEMENTS_CANCEL);
233-
assertThat(longRunningConfig.implementsDelete()).isEqualTo(TEST_IMPLEMENTS_DELETE);
234220
}
235221

236222
@Test

src/test/java/com/google/api/codegen/gapic/testdata/go/go_library.baseline

-16
Original file line numberDiff line numberDiff line change
@@ -1129,15 +1129,6 @@ func (op *GetBigBookOperation) Name() string {
11291129
return op.lro.Name()
11301130
}
11311131

1132-
// Cancel starts asynchronous cancellation on a long-running operation.
1133-
// The server makes a best effort to cancel the operation, but success is not guaranteed.
1134-
// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation
1135-
// completed despite cancellation. On successful cancellation, the operation is not deleted;
1136-
// instead, op.Poll returns an error with code Canceled.
1137-
func (op *GetBigBookOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error {
1138-
return op.lro.Cancel(ctx, opts...)
1139-
}
1140-
11411132
// GetBigNothingOperation manages a long-running operation from GetBigNothing.
11421133
type GetBigNothingOperation struct {
11431134
lro *longrunning.Operation
@@ -1194,13 +1185,6 @@ func (op *GetBigNothingOperation) Name() string {
11941185
return op.lro.Name()
11951186
}
11961187

1197-
1198-
// Delete deletes a long-running operation.
1199-
// This method indicates that the client is no longer interested in the operation result.
1200-
// It does not cancel the operation.
1201-
func (op *GetBigNothingOperation) Delete(ctx context.Context, opts ...gax.CallOption) error {
1202-
return op.lro.Delete(ctx, opts...)
1203-
}
12041188
============== file: cloud.google.com/go/library/apiv1/library_client_example_test.go ==============
12051189
// Copyright 2019 Google LLC
12061190
//

src/test/java/com/google/api/codegen/testsrc/common/library_gapic.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,6 @@ interfaces:
841841
long_running:
842842
return_type: google.example.library.v1.Book
843843
metadata_type: google.example.library.v1.GetBigBookMetadata
844-
implements_cancel: true
845844
initial_poll_delay_millis: 3000
846845
poll_delay_multiplier: 1.3
847846
max_poll_delay_millis: 30000
@@ -931,7 +930,6 @@ interfaces:
931930
long_running:
932931
return_type: google.protobuf.Empty
933932
metadata_type: google.example.library.v1.GetBigBookMetadata
934-
implements_delete: true
935933
initial_poll_delay_millis: 3000
936934
poll_delay_multiplier: 1.3
937935
max_poll_delay_millis: 60000

0 commit comments

Comments
 (0)