Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cloud storage subscription fields #1724

Merged
merged 3 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 80 additions & 7 deletions protos/google/pubsub/v1/pubsub.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -647,9 +647,9 @@ service Subscriber {
}
}

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

// If delivery to Google Cloud Storage is used with this subscription, this
// field is used to configure it.
CloudStorageConfig cloud_storage_config = 22;

// The approximate amount of time (on a best-effort basis) Pub/Sub waits for
// the subscriber to acknowledge receipt before resending the message. In the
// interval after the message is delivered and before it is acknowledged, it
Expand Down Expand Up @@ -885,9 +889,9 @@ message PushConfig {
message OidcToken {
// [Service account
// email](https://cloud.google.com/iam/docs/service-accounts)
// to be used for generating the OIDC token. The caller (for
// CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
// have the iam.serviceAccounts.actAs permission for the service account.
// used for generating the OIDC token. For more information
// on setting up authentication, see
// [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
string service_account_email = 1;

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

// Configuration for a Cloud Storage subscription.
message CloudStorageConfig {
// Configuration for writing message data in text format.
// Message payloads will be written to files as raw text, separated by a
// newline.
message TextConfig {}

// Configuration for writing message data in Avro format.
// Message payloads and metadata will be written to files as an Avro binary.
message AvroConfig {
// When true, write the subscription name, message_id, publish_time,
// attributes, and ordering_key as additional fields in the output.
bool write_metadata = 1;
}

// Possible states for a Cloud Storage subscription.
enum State {
// Default value. This value is unused.
STATE_UNSPECIFIED = 0;

// The subscription can actively send messages to Cloud Storage.
ACTIVE = 1;

// Cannot write to the Cloud Storage bucket because of permission denied
// errors.
PERMISSION_DENIED = 2;

// Cannot write to the Cloud Storage bucket because it does not exist.
NOT_FOUND = 3;
}

// Required. User-provided name for the Cloud Storage bucket.
// The bucket must be created by the user. The bucket name must be without
// any prefix like "gs://". See the [bucket naming
// requirements] (https://cloud.google.com/storage/docs/buckets#naming).
string bucket = 1 [(google.api.field_behavior) = REQUIRED];

// User-provided prefix for Cloud Storage filename. See the [object naming
// requirements](https://cloud.google.com/storage/docs/objects#naming).
string filename_prefix = 2;

// User-provided suffix for Cloud Storage filename. See the [object naming
// requirements](https://cloud.google.com/storage/docs/objects#naming).
string filename_suffix = 3;

// Defaults to text format.
oneof output_format {
// If set, message data will be written to Cloud Storage in text format.
TextConfig text_config = 4;

// If set, message data will be written to Cloud Storage in Avro format.
AvroConfig avro_config = 5;
}

// The maximum duration that can elapse before a new Cloud Storage file is
// created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed
// the subscription's acknowledgement deadline.
google.protobuf.Duration max_duration = 6;

// The maximum bytes that can be written to a Cloud Storage file before a new
// file is created. Min 1 KB, max 10 GiB. The max_bytes limit may be exceeded
// in cases where messages are larger than the limit.
int64 max_bytes = 7;

// Output only. An output-only field that indicates whether or not the
// subscription can receive messages.
State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A message and its corresponding acknowledgment ID.
message ReceivedMessage {
// This ID can be used to acknowledge the received message.
Expand Down
2 changes: 1 addition & 1 deletion protos/google/pubsub/v1/schema.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading