Skip to content

Commit 4cc3e58

Browse files
yoshi-automationjskeet
authored andcommitted
feat: Add topic retention options
PiperOrigin-RevId: 389879008 Source-Author: Google APIs <noreply@google.com> Source-Date: Tue Aug 10 07:28:42 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 7b6a2ceed6cacf676b3918b1703b3ddd6322444c Source-Link: googleapis/googleapis@7b6a2ce
1 parent 9c8f71f commit 4cc3e58

File tree

8 files changed

+388
-238
lines changed

8 files changed

+388
-238
lines changed

‎apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1.Snippets/PublisherServiceApiClientSnippets.g.cs

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public void CreateTopicRequestObject()
4242
KmsKeyName = "",
4343
SchemaSettings = new SchemaSettings(),
4444
SatisfiesPzs = false,
45+
MessageRetentionDuration = new Duration(),
4546
};
4647
// Make the request
4748
Topic response = publisherServiceApiClient.CreateTopic(request);
@@ -64,6 +65,7 @@ public async Task CreateTopicRequestObjectAsync()
6465
KmsKeyName = "",
6566
SchemaSettings = new SchemaSettings(),
6667
SatisfiesPzs = false,
68+
MessageRetentionDuration = new Duration(),
6769
};
6870
// Make the request
6971
Topic response = await publisherServiceApiClient.CreateTopicAsync(request);

‎apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1.Snippets/SubscriberServiceApiClientSnippets.g.cs

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void CreateSubscriptionRequestObject()
5050
DeadLetterPolicy = new DeadLetterPolicy(),
5151
RetryPolicy = new RetryPolicy(),
5252
Detached = false,
53+
TopicMessageRetentionDuration = new Duration(),
5354
};
5455
// Make the request
5556
Subscription response = subscriberServiceApiClient.CreateSubscription(request);
@@ -79,6 +80,7 @@ public async Task CreateSubscriptionRequestObjectAsync()
7980
DeadLetterPolicy = new DeadLetterPolicy(),
8081
RetryPolicy = new RetryPolicy(),
8182
Detached = false,
83+
TopicMessageRetentionDuration = new Duration(),
8284
};
8385
// Make the request
8486
Subscription response = await subscriberServiceApiClient.CreateSubscriptionAsync(request);

‎apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1.Tests/PublisherServiceApiClientTest.g.cs

+16
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public void CreateTopicRequestObject()
4545
KmsKeyName = "kms_key_name06bd122b",
4646
SchemaSettings = new SchemaSettings(),
4747
SatisfiesPzs = false,
48+
MessageRetentionDuration = new wkt::Duration(),
4849
};
4950
Topic expectedResponse = new Topic
5051
{
@@ -60,6 +61,7 @@ public void CreateTopicRequestObject()
6061
KmsKeyName = "kms_key_name06bd122b",
6162
SchemaSettings = new SchemaSettings(),
6263
SatisfiesPzs = false,
64+
MessageRetentionDuration = new wkt::Duration(),
6365
};
6466
mockGrpcClient.Setup(x => x.CreateTopic(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
6567
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -86,6 +88,7 @@ public void CreateTopicRequestObject()
8688
KmsKeyName = "kms_key_name06bd122b",
8789
SchemaSettings = new SchemaSettings(),
8890
SatisfiesPzs = false,
91+
MessageRetentionDuration = new wkt::Duration(),
8992
};
9093
Topic expectedResponse = new Topic
9194
{
@@ -101,6 +104,7 @@ public void CreateTopicRequestObject()
101104
KmsKeyName = "kms_key_name06bd122b",
102105
SchemaSettings = new SchemaSettings(),
103106
SatisfiesPzs = false,
107+
MessageRetentionDuration = new wkt::Duration(),
104108
};
105109
mockGrpcClient.Setup(x => x.CreateTopicAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Topic>(stt::Task.FromResult(expectedResponse), null, null, null, null));
106110
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -133,6 +137,7 @@ public void CreateTopic()
133137
KmsKeyName = "kms_key_name06bd122b",
134138
SchemaSettings = new SchemaSettings(),
135139
SatisfiesPzs = false,
140+
MessageRetentionDuration = new wkt::Duration(),
136141
};
137142
mockGrpcClient.Setup(x => x.CreateTopic(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
138143
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -163,6 +168,7 @@ public void CreateTopic()
163168
KmsKeyName = "kms_key_name06bd122b",
164169
SchemaSettings = new SchemaSettings(),
165170
SatisfiesPzs = false,
171+
MessageRetentionDuration = new wkt::Duration(),
166172
};
167173
mockGrpcClient.Setup(x => x.CreateTopicAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Topic>(stt::Task.FromResult(expectedResponse), null, null, null, null));
168174
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -195,6 +201,7 @@ public void CreateTopicResourceNames()
195201
KmsKeyName = "kms_key_name06bd122b",
196202
SchemaSettings = new SchemaSettings(),
197203
SatisfiesPzs = false,
204+
MessageRetentionDuration = new wkt::Duration(),
198205
};
199206
mockGrpcClient.Setup(x => x.CreateTopic(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
200207
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -225,6 +232,7 @@ public void CreateTopicResourceNames()
225232
KmsKeyName = "kms_key_name06bd122b",
226233
SchemaSettings = new SchemaSettings(),
227234
SatisfiesPzs = false,
235+
MessageRetentionDuration = new wkt::Duration(),
228236
};
229237
mockGrpcClient.Setup(x => x.CreateTopicAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Topic>(stt::Task.FromResult(expectedResponse), null, null, null, null));
230238
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -258,6 +266,7 @@ public void UpdateTopicRequestObject()
258266
KmsKeyName = "kms_key_name06bd122b",
259267
SchemaSettings = new SchemaSettings(),
260268
SatisfiesPzs = false,
269+
MessageRetentionDuration = new wkt::Duration(),
261270
};
262271
mockGrpcClient.Setup(x => x.UpdateTopic(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
263272
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -289,6 +298,7 @@ public void UpdateTopicRequestObject()
289298
KmsKeyName = "kms_key_name06bd122b",
290299
SchemaSettings = new SchemaSettings(),
291300
SatisfiesPzs = false,
301+
MessageRetentionDuration = new wkt::Duration(),
292302
};
293303
mockGrpcClient.Setup(x => x.UpdateTopicAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Topic>(stt::Task.FromResult(expectedResponse), null, null, null, null));
294304
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -483,6 +493,7 @@ public void GetTopicRequestObject()
483493
KmsKeyName = "kms_key_name06bd122b",
484494
SchemaSettings = new SchemaSettings(),
485495
SatisfiesPzs = false,
496+
MessageRetentionDuration = new wkt::Duration(),
486497
};
487498
mockGrpcClient.Setup(x => x.GetTopic(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
488499
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -513,6 +524,7 @@ public void GetTopicRequestObject()
513524
KmsKeyName = "kms_key_name06bd122b",
514525
SchemaSettings = new SchemaSettings(),
515526
SatisfiesPzs = false,
527+
MessageRetentionDuration = new wkt::Duration(),
516528
};
517529
mockGrpcClient.Setup(x => x.GetTopicAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Topic>(stt::Task.FromResult(expectedResponse), null, null, null, null));
518530
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -545,6 +557,7 @@ public void GetTopic()
545557
KmsKeyName = "kms_key_name06bd122b",
546558
SchemaSettings = new SchemaSettings(),
547559
SatisfiesPzs = false,
560+
MessageRetentionDuration = new wkt::Duration(),
548561
};
549562
mockGrpcClient.Setup(x => x.GetTopic(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
550563
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -575,6 +588,7 @@ public void GetTopic()
575588
KmsKeyName = "kms_key_name06bd122b",
576589
SchemaSettings = new SchemaSettings(),
577590
SatisfiesPzs = false,
591+
MessageRetentionDuration = new wkt::Duration(),
578592
};
579593
mockGrpcClient.Setup(x => x.GetTopicAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Topic>(stt::Task.FromResult(expectedResponse), null, null, null, null));
580594
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -607,6 +621,7 @@ public void GetTopicResourceNames()
607621
KmsKeyName = "kms_key_name06bd122b",
608622
SchemaSettings = new SchemaSettings(),
609623
SatisfiesPzs = false,
624+
MessageRetentionDuration = new wkt::Duration(),
610625
};
611626
mockGrpcClient.Setup(x => x.GetTopic(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
612627
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -637,6 +652,7 @@ public void GetTopicResourceNames()
637652
KmsKeyName = "kms_key_name06bd122b",
638653
SchemaSettings = new SchemaSettings(),
639654
SatisfiesPzs = false,
655+
MessageRetentionDuration = new wkt::Duration(),
640656
};
641657
mockGrpcClient.Setup(x => x.GetTopicAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Topic>(stt::Task.FromResult(expectedResponse), null, null, null, null));
642658
PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);

‎apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1.Tests/SubscriberServiceApiClientTest.g.cs

+16
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void CreateSubscriptionRequestObject()
5252
DeadLetterPolicy = new DeadLetterPolicy(),
5353
RetryPolicy = new RetryPolicy(),
5454
Detached = false,
55+
TopicMessageRetentionDuration = new wkt::Duration(),
5556
};
5657
Subscription expectedResponse = new Subscription
5758
{
@@ -74,6 +75,7 @@ public void CreateSubscriptionRequestObject()
7475
DeadLetterPolicy = new DeadLetterPolicy(),
7576
RetryPolicy = new RetryPolicy(),
7677
Detached = false,
78+
TopicMessageRetentionDuration = new wkt::Duration(),
7779
};
7880
mockGrpcClient.Setup(x => x.CreateSubscription(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
7981
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -107,6 +109,7 @@ public void CreateSubscriptionRequestObject()
107109
DeadLetterPolicy = new DeadLetterPolicy(),
108110
RetryPolicy = new RetryPolicy(),
109111
Detached = false,
112+
TopicMessageRetentionDuration = new wkt::Duration(),
110113
};
111114
Subscription expectedResponse = new Subscription
112115
{
@@ -129,6 +132,7 @@ public void CreateSubscriptionRequestObject()
129132
DeadLetterPolicy = new DeadLetterPolicy(),
130133
RetryPolicy = new RetryPolicy(),
131134
Detached = false,
135+
TopicMessageRetentionDuration = new wkt::Duration(),
132136
};
133137
mockGrpcClient.Setup(x => x.CreateSubscriptionAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Subscription>(stt::Task.FromResult(expectedResponse), null, null, null, null));
134138
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -171,6 +175,7 @@ public void CreateSubscription()
171175
DeadLetterPolicy = new DeadLetterPolicy(),
172176
RetryPolicy = new RetryPolicy(),
173177
Detached = false,
178+
TopicMessageRetentionDuration = new wkt::Duration(),
174179
};
175180
mockGrpcClient.Setup(x => x.CreateSubscription(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
176181
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -211,6 +216,7 @@ public void CreateSubscription()
211216
DeadLetterPolicy = new DeadLetterPolicy(),
212217
RetryPolicy = new RetryPolicy(),
213218
Detached = false,
219+
TopicMessageRetentionDuration = new wkt::Duration(),
214220
};
215221
mockGrpcClient.Setup(x => x.CreateSubscriptionAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Subscription>(stt::Task.FromResult(expectedResponse), null, null, null, null));
216222
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -253,6 +259,7 @@ public void CreateSubscriptionResourceNames()
253259
DeadLetterPolicy = new DeadLetterPolicy(),
254260
RetryPolicy = new RetryPolicy(),
255261
Detached = false,
262+
TopicMessageRetentionDuration = new wkt::Duration(),
256263
};
257264
mockGrpcClient.Setup(x => x.CreateSubscription(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
258265
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -293,6 +300,7 @@ public void CreateSubscriptionResourceNames()
293300
DeadLetterPolicy = new DeadLetterPolicy(),
294301
RetryPolicy = new RetryPolicy(),
295302
Detached = false,
303+
TopicMessageRetentionDuration = new wkt::Duration(),
296304
};
297305
mockGrpcClient.Setup(x => x.CreateSubscriptionAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Subscription>(stt::Task.FromResult(expectedResponse), null, null, null, null));
298306
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -332,6 +340,7 @@ public void GetSubscriptionRequestObject()
332340
DeadLetterPolicy = new DeadLetterPolicy(),
333341
RetryPolicy = new RetryPolicy(),
334342
Detached = false,
343+
TopicMessageRetentionDuration = new wkt::Duration(),
335344
};
336345
mockGrpcClient.Setup(x => x.GetSubscription(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
337346
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -369,6 +378,7 @@ public void GetSubscriptionRequestObject()
369378
DeadLetterPolicy = new DeadLetterPolicy(),
370379
RetryPolicy = new RetryPolicy(),
371380
Detached = false,
381+
TopicMessageRetentionDuration = new wkt::Duration(),
372382
};
373383
mockGrpcClient.Setup(x => x.GetSubscriptionAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Subscription>(stt::Task.FromResult(expectedResponse), null, null, null, null));
374384
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -408,6 +418,7 @@ public void GetSubscription()
408418
DeadLetterPolicy = new DeadLetterPolicy(),
409419
RetryPolicy = new RetryPolicy(),
410420
Detached = false,
421+
TopicMessageRetentionDuration = new wkt::Duration(),
411422
};
412423
mockGrpcClient.Setup(x => x.GetSubscription(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
413424
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -445,6 +456,7 @@ public void GetSubscription()
445456
DeadLetterPolicy = new DeadLetterPolicy(),
446457
RetryPolicy = new RetryPolicy(),
447458
Detached = false,
459+
TopicMessageRetentionDuration = new wkt::Duration(),
448460
};
449461
mockGrpcClient.Setup(x => x.GetSubscriptionAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Subscription>(stt::Task.FromResult(expectedResponse), null, null, null, null));
450462
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -484,6 +496,7 @@ public void GetSubscriptionResourceNames()
484496
DeadLetterPolicy = new DeadLetterPolicy(),
485497
RetryPolicy = new RetryPolicy(),
486498
Detached = false,
499+
TopicMessageRetentionDuration = new wkt::Duration(),
487500
};
488501
mockGrpcClient.Setup(x => x.GetSubscription(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
489502
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -521,6 +534,7 @@ public void GetSubscriptionResourceNames()
521534
DeadLetterPolicy = new DeadLetterPolicy(),
522535
RetryPolicy = new RetryPolicy(),
523536
Detached = false,
537+
TopicMessageRetentionDuration = new wkt::Duration(),
524538
};
525539
mockGrpcClient.Setup(x => x.GetSubscriptionAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Subscription>(stt::Task.FromResult(expectedResponse), null, null, null, null));
526540
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -561,6 +575,7 @@ public void UpdateSubscriptionRequestObject()
561575
DeadLetterPolicy = new DeadLetterPolicy(),
562576
RetryPolicy = new RetryPolicy(),
563577
Detached = false,
578+
TopicMessageRetentionDuration = new wkt::Duration(),
564579
};
565580
mockGrpcClient.Setup(x => x.UpdateSubscription(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
566581
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);
@@ -599,6 +614,7 @@ public void UpdateSubscriptionRequestObject()
599614
DeadLetterPolicy = new DeadLetterPolicy(),
600615
RetryPolicy = new RetryPolicy(),
601616
Detached = false,
617+
TopicMessageRetentionDuration = new wkt::Duration(),
602618
};
603619
mockGrpcClient.Setup(x => x.UpdateSubscriptionAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Subscription>(stt::Task.FromResult(expectedResponse), null, null, null, null));
604620
SubscriberServiceApiClient client = new SubscriberServiceApiClientImpl(mockGrpcClient.Object, null);

0 commit comments

Comments
 (0)