Skip to content

Commit 8a4cc94

Browse files
Google APIscopybara-github
authored andcommitted
feat: add cloud storage subscription fields
PiperOrigin-RevId: 531202368
1 parent 2845078 commit 8a4cc94

4 files changed

Lines changed: 137 additions & 10 deletions

File tree

google/pubsub/v1/pubsub.proto

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Google LLC
1+
// Copyright 2023 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -647,9 +647,9 @@ service Subscriber {
647647
}
648648
}
649649

650-
// A subscription resource. If none of `push_config` or `bigquery_config` is
651-
// set, then the subscriber will pull and ack messages using API methods. At
652-
// most one of these fields may be set.
650+
// A subscription resource. If none of `push_config`, `bigquery_config`, or
651+
// `cloud_storage_config` is set, then the subscriber will pull and ack messages
652+
// using API methods. At most one of these fields may be set.
653653
message Subscription {
654654
option (google.api.resource) = {
655655
type: "pubsub.googleapis.com/Subscription"
@@ -694,6 +694,10 @@ message Subscription {
694694
// used to configure it.
695695
BigQueryConfig bigquery_config = 18;
696696

697+
// If delivery to Google Cloud Storage is used with this subscription, this
698+
// field is used to configure it.
699+
CloudStorageConfig cloud_storage_config = 22;
700+
697701
// The approximate amount of time (on a best-effort basis) Pub/Sub waits for
698702
// the subscriber to acknowledge receipt before resending the message. In the
699703
// interval after the message is delivered and before it is acknowledged, it
@@ -885,9 +889,9 @@ message PushConfig {
885889
message OidcToken {
886890
// [Service account
887891
// email](https://cloud.google.com/iam/docs/service-accounts)
888-
// to be used for generating the OIDC token. The caller (for
889-
// CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
890-
// have the iam.serviceAccounts.actAs permission for the service account.
892+
// used for generating the OIDC token. For more information
893+
// on setting up authentication, see
894+
// [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
891895
string service_account_email = 1;
892896

893897
// Audience to be used when generating OIDC token. The audience claim
@@ -990,6 +994,75 @@ message BigQueryConfig {
990994
State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
991995
}
992996

997+
// Configuration for a Cloud Storage subscription.
998+
message CloudStorageConfig {
999+
// Configuration for writing message data in text format.
1000+
// Message payloads will be written to files as raw text, separated by a
1001+
// newline.
1002+
message TextConfig {}
1003+
1004+
// Configuration for writing message data in Avro format.
1005+
// Message payloads and metadata will be written to files as an Avro binary.
1006+
message AvroConfig {
1007+
// When true, write the subscription name, message_id, publish_time,
1008+
// attributes, and ordering_key as additional fields in the output.
1009+
bool write_metadata = 1;
1010+
}
1011+
1012+
// Possible states for a Cloud Storage subscription.
1013+
enum State {
1014+
// Default value. This value is unused.
1015+
STATE_UNSPECIFIED = 0;
1016+
1017+
// The subscription can actively send messages to Cloud Storage.
1018+
ACTIVE = 1;
1019+
1020+
// Cannot write to the Cloud Storage bucket because of permission denied
1021+
// errors.
1022+
PERMISSION_DENIED = 2;
1023+
1024+
// Cannot write to the Cloud Storage bucket because it does not exist.
1025+
NOT_FOUND = 3;
1026+
}
1027+
1028+
// Required. User-provided name for the Cloud Storage bucket.
1029+
// The bucket must be created by the user. The bucket name must be without
1030+
// any prefix like "gs://". See the [bucket naming
1031+
// requirements] (https://cloud.google.com/storage/docs/buckets#naming).
1032+
string bucket = 1 [(google.api.field_behavior) = REQUIRED];
1033+
1034+
// User-provided prefix for Cloud Storage filename. See the [object naming
1035+
// requirements](https://cloud.google.com/storage/docs/objects#naming).
1036+
string filename_prefix = 2;
1037+
1038+
// User-provided suffix for Cloud Storage filename. See the [object naming
1039+
// requirements](https://cloud.google.com/storage/docs/objects#naming).
1040+
string filename_suffix = 3;
1041+
1042+
// Defaults to text format.
1043+
oneof output_format {
1044+
// If set, message data will be written to Cloud Storage in text format.
1045+
TextConfig text_config = 4;
1046+
1047+
// If set, message data will be written to Cloud Storage in Avro format.
1048+
AvroConfig avro_config = 5;
1049+
}
1050+
1051+
// The maximum duration that can elapse before a new Cloud Storage file is
1052+
// created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed
1053+
// the subscription's acknowledgement deadline.
1054+
google.protobuf.Duration max_duration = 6;
1055+
1056+
// The maximum bytes that can be written to a Cloud Storage file before a new
1057+
// file is created. Min 1 KB, max 10 GiB. The max_bytes limit may be exceeded
1058+
// in cases where messages are larger than the limit.
1059+
int64 max_bytes = 7;
1060+
1061+
// Output only. An output-only field that indicates whether or not the
1062+
// subscription can receive messages.
1063+
State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
1064+
}
1065+
9931066
// A message and its corresponding acknowledgment ID.
9941067
message ReceivedMessage {
9951068
// This ID can be used to acknowledge the received message.

google/pubsub/v1/pubsub_grpc_service_config.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,60 @@
238238
"UNAVAILABLE"
239239
]
240240
}
241+
},
242+
{
243+
"name": [
244+
{
245+
"service": "google.pubsub.v1.SchemaService",
246+
"method": "CommitSchema"
247+
},
248+
{
249+
"service": "google.pubsub.v1.SchemaService",
250+
"method": "CreateSchema"
251+
},
252+
{
253+
"service": "google.pubsub.v1.SchemaService",
254+
"method": "DeleteSchema"
255+
},
256+
{
257+
"service": "google.pubsub.v1.SchemaService",
258+
"method": "DeleteSchemaRevision"
259+
},
260+
{
261+
"service": "google.pubsub.v1.SchemaService",
262+
"method": "GetSchema"
263+
},
264+
{
265+
"service": "google.pubsub.v1.SchemaService",
266+
"method": "ListSchemaRevisions"
267+
},
268+
{
269+
"service": "google.pubsub.v1.SchemaService",
270+
"method": "ListSchemas"
271+
},
272+
{
273+
"service": "google.pubsub.v1.SchemaService",
274+
"method": "RollbackSchema"
275+
},
276+
{
277+
"service": "google.pubsub.v1.SchemaService",
278+
"method": "ValidateSchema"
279+
},
280+
{
281+
"service": "google.pubsub.v1.SchemaService",
282+
"method": "ValidateMessage"
283+
}
284+
],
285+
"timeout": "60s",
286+
"retryPolicy": {
287+
"maxAttempts": 5,
288+
"initialBackoff": "0.100s",
289+
"maxBackoff": "60s",
290+
"backoffMultiplier": 1.3,
291+
"retryableStatusCodes": [
292+
"UNAVAILABLE"
293+
]
294+
}
241295
}
242296
]
243297
}

google/pubsub/v1/pubsub_v1.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ name: pubsub.googleapis.com
44
title: Cloud Pub/Sub API
55

66
apis:
7+
- name: google.iam.v1.IAMPolicy
78
- name: google.pubsub.v1.Publisher
89
- name: google.pubsub.v1.SchemaService
910
- name: google.pubsub.v1.Subscriber
10-
- name: google.iam.v1.IAMPolicy
1111

1212
documentation:
1313
summary: |-
@@ -42,7 +42,7 @@ backend:
4242
- selector: 'google.pubsub.v1.Publisher.*'
4343
deadline: 120.0
4444
- selector: google.pubsub.v1.Publisher.Publish
45-
deadline: 20.0
45+
deadline: 25.0
4646
- selector: 'google.pubsub.v1.Subscriber.*'
4747
deadline: 120.0
4848

google/pubsub/v1/schema.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Google LLC
1+
// Copyright 2023 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)