Skip to content

Commit e4226b7

Browse files
authored
Regenerate Google.Cloud.PubSub.V1 (#4515)
- PullRequest.ReturnImmediately is now obsolete - ListTopicSnapshots methods have new overloads accepting a topic name - GetSnapshot methods have new overloads accepting a snapshot name
1 parent 4336172 commit e4226b7

File tree

7 files changed

+991
-344
lines changed

7 files changed

+991
-344
lines changed

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

+188-2
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,10 @@ public void ListTopicSnapshotsRequestObject()
912912
// Create client
913913
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
914914
// Initialize request argument(s)
915-
ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest { Topic = "", };
915+
ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
916+
{
917+
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
918+
};
916919
// Make the request
917920
PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(request);
918921

@@ -957,7 +960,10 @@ public async Task ListTopicSnapshotsRequestObjectAsync()
957960
// Create client
958961
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
959962
// Initialize request argument(s)
960-
ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest { Topic = "", };
963+
ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
964+
{
965+
TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
966+
};
961967
// Make the request
962968
PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(request);
963969

@@ -995,6 +1001,186 @@ await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =
9951001
// End snippet
9961002
}
9971003

1004+
/// <summary>Snippet for ListTopicSnapshots</summary>
1005+
public void ListTopicSnapshots()
1006+
{
1007+
// Snippet: ListTopicSnapshots(string, string, int?, CallSettings)
1008+
// Create client
1009+
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
1010+
// Initialize request argument(s)
1011+
string topic = "projects/[PROJECT]/topics/[TOPIC]";
1012+
// Make the request
1013+
PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(topic);
1014+
1015+
// Iterate over all response items, lazily performing RPCs as required
1016+
foreach (string item in response)
1017+
{
1018+
// Do something with each item
1019+
Console.WriteLine(item);
1020+
}
1021+
1022+
// Or iterate over pages (of server-defined size), performing one RPC per page
1023+
foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
1024+
{
1025+
// Do something with each page of items
1026+
Console.WriteLine("A page of results:");
1027+
foreach (string item in page)
1028+
{
1029+
// Do something with each item
1030+
Console.WriteLine(item);
1031+
}
1032+
}
1033+
1034+
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1035+
int pageSize = 10;
1036+
Page<string> singlePage = response.ReadPage(pageSize);
1037+
// Do something with the page of items
1038+
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
1039+
foreach (string item in singlePage)
1040+
{
1041+
// Do something with each item
1042+
Console.WriteLine(item);
1043+
}
1044+
// Store the pageToken, for when the next page is required.
1045+
string nextPageToken = singlePage.NextPageToken;
1046+
// End snippet
1047+
}
1048+
1049+
/// <summary>Snippet for ListTopicSnapshots</summary>
1050+
public async Task ListTopicSnapshotsAsync()
1051+
{
1052+
// Snippet: ListTopicSnapshotsAsync(string, string, int?, CallSettings)
1053+
// Create client
1054+
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
1055+
// Initialize request argument(s)
1056+
string topic = "projects/[PROJECT]/topics/[TOPIC]";
1057+
// Make the request
1058+
PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(topic);
1059+
1060+
// Iterate over all response items, lazily performing RPCs as required
1061+
await response.ForEachAsync((string item) =>
1062+
{
1063+
// Do something with each item
1064+
Console.WriteLine(item);
1065+
});
1066+
1067+
// Or iterate over pages (of server-defined size), performing one RPC per page
1068+
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
1069+
{
1070+
// Do something with each page of items
1071+
Console.WriteLine("A page of results:");
1072+
foreach (string item in page)
1073+
{
1074+
// Do something with each item
1075+
Console.WriteLine(item);
1076+
}
1077+
});
1078+
1079+
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1080+
int pageSize = 10;
1081+
Page<string> singlePage = await response.ReadPageAsync(pageSize);
1082+
// Do something with the page of items
1083+
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
1084+
foreach (string item in singlePage)
1085+
{
1086+
// Do something with each item
1087+
Console.WriteLine(item);
1088+
}
1089+
// Store the pageToken, for when the next page is required.
1090+
string nextPageToken = singlePage.NextPageToken;
1091+
// End snippet
1092+
}
1093+
1094+
/// <summary>Snippet for ListTopicSnapshots</summary>
1095+
public void ListTopicSnapshotsResourceNames()
1096+
{
1097+
// Snippet: ListTopicSnapshots(TopicName, string, int?, CallSettings)
1098+
// Create client
1099+
PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
1100+
// Initialize request argument(s)
1101+
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
1102+
// Make the request
1103+
PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(topic);
1104+
1105+
// Iterate over all response items, lazily performing RPCs as required
1106+
foreach (string item in response)
1107+
{
1108+
// Do something with each item
1109+
Console.WriteLine(item);
1110+
}
1111+
1112+
// Or iterate over pages (of server-defined size), performing one RPC per page
1113+
foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
1114+
{
1115+
// Do something with each page of items
1116+
Console.WriteLine("A page of results:");
1117+
foreach (string item in page)
1118+
{
1119+
// Do something with each item
1120+
Console.WriteLine(item);
1121+
}
1122+
}
1123+
1124+
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1125+
int pageSize = 10;
1126+
Page<string> singlePage = response.ReadPage(pageSize);
1127+
// Do something with the page of items
1128+
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
1129+
foreach (string item in singlePage)
1130+
{
1131+
// Do something with each item
1132+
Console.WriteLine(item);
1133+
}
1134+
// Store the pageToken, for when the next page is required.
1135+
string nextPageToken = singlePage.NextPageToken;
1136+
// End snippet
1137+
}
1138+
1139+
/// <summary>Snippet for ListTopicSnapshots</summary>
1140+
public async Task ListTopicSnapshotsResourceNamesAsync()
1141+
{
1142+
// Snippet: ListTopicSnapshotsAsync(TopicName, string, int?, CallSettings)
1143+
// Create client
1144+
PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
1145+
// Initialize request argument(s)
1146+
TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
1147+
// Make the request
1148+
PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(topic);
1149+
1150+
// Iterate over all response items, lazily performing RPCs as required
1151+
await response.ForEachAsync((string item) =>
1152+
{
1153+
// Do something with each item
1154+
Console.WriteLine(item);
1155+
});
1156+
1157+
// Or iterate over pages (of server-defined size), performing one RPC per page
1158+
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
1159+
{
1160+
// Do something with each page of items
1161+
Console.WriteLine("A page of results:");
1162+
foreach (string item in page)
1163+
{
1164+
// Do something with each item
1165+
Console.WriteLine(item);
1166+
}
1167+
});
1168+
1169+
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
1170+
int pageSize = 10;
1171+
Page<string> singlePage = await response.ReadPageAsync(pageSize);
1172+
// Do something with the page of items
1173+
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
1174+
foreach (string item in singlePage)
1175+
{
1176+
// Do something with each item
1177+
Console.WriteLine(item);
1178+
}
1179+
// Store the pageToken, for when the next page is required.
1180+
string nextPageToken = singlePage.NextPageToken;
1181+
// End snippet
1182+
}
1183+
9981184
/// <summary>Snippet for DeleteTopic</summary>
9991185
public void DeleteTopicRequestObject()
10001186
{

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

+54-2
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,6 @@ public void PullRequestObject()
832832
PullRequest request = new PullRequest
833833
{
834834
SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
835-
ReturnImmediately = false,
836835
MaxMessages = 0,
837836
};
838837
// Make the request
@@ -851,7 +850,6 @@ public async Task PullRequestObjectAsync()
851850
PullRequest request = new PullRequest
852851
{
853852
SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
854-
ReturnImmediately = false,
855853
MaxMessages = 0,
856854
};
857855
// Make the request
@@ -1099,6 +1097,60 @@ public async Task GetSnapshotRequestObjectAsync()
10991097
// End snippet
11001098
}
11011099

1100+
/// <summary>Snippet for GetSnapshot</summary>
1101+
public void GetSnapshot()
1102+
{
1103+
// Snippet: GetSnapshot(string, CallSettings)
1104+
// Create client
1105+
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
1106+
// Initialize request argument(s)
1107+
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
1108+
// Make the request
1109+
Snapshot response = subscriberServiceApiClient.GetSnapshot(snapshot);
1110+
// End snippet
1111+
}
1112+
1113+
/// <summary>Snippet for GetSnapshotAsync</summary>
1114+
public async Task GetSnapshotAsync()
1115+
{
1116+
// Snippet: GetSnapshotAsync(string, CallSettings)
1117+
// Additional: GetSnapshotAsync(string, CancellationToken)
1118+
// Create client
1119+
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
1120+
// Initialize request argument(s)
1121+
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
1122+
// Make the request
1123+
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(snapshot);
1124+
// End snippet
1125+
}
1126+
1127+
/// <summary>Snippet for GetSnapshot</summary>
1128+
public void GetSnapshotResourceNames()
1129+
{
1130+
// Snippet: GetSnapshot(SnapshotName, CallSettings)
1131+
// Create client
1132+
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
1133+
// Initialize request argument(s)
1134+
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
1135+
// Make the request
1136+
Snapshot response = subscriberServiceApiClient.GetSnapshot(snapshot);
1137+
// End snippet
1138+
}
1139+
1140+
/// <summary>Snippet for GetSnapshotAsync</summary>
1141+
public async Task GetSnapshotResourceNamesAsync()
1142+
{
1143+
// Snippet: GetSnapshotAsync(SnapshotName, CallSettings)
1144+
// Additional: GetSnapshotAsync(SnapshotName, CancellationToken)
1145+
// Create client
1146+
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
1147+
// Initialize request argument(s)
1148+
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
1149+
// Make the request
1150+
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(snapshot);
1151+
// End snippet
1152+
}
1153+
11021154
/// <summary>Snippet for ListSnapshots</summary>
11031155
public void ListSnapshotsRequestObject()
11041156
{

0 commit comments

Comments
 (0)