Skip to content

Commit

Permalink
feat: add cloud storage subscription fields
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 531202368
  • Loading branch information
Google APIs authored and Copybara-Service committed May 11, 2023
1 parent 2845078 commit 8a4cc94
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 10 deletions.
87 changes: 80 additions & 7 deletions 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
54 changes: 54 additions & 0 deletions google/pubsub/v1/pubsub_grpc_service_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,60 @@
"UNAVAILABLE"
]
}
},
{
"name": [
{
"service": "google.pubsub.v1.SchemaService",
"method": "CommitSchema"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "CreateSchema"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "DeleteSchema"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "DeleteSchemaRevision"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "GetSchema"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "ListSchemaRevisions"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "ListSchemas"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "RollbackSchema"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "ValidateSchema"
},
{
"service": "google.pubsub.v1.SchemaService",
"method": "ValidateMessage"
}
],
"timeout": "60s",
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "0.100s",
"maxBackoff": "60s",
"backoffMultiplier": 1.3,
"retryableStatusCodes": [
"UNAVAILABLE"
]
}
}
]
}
4 changes: 2 additions & 2 deletions google/pubsub/v1/pubsub_v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ name: pubsub.googleapis.com
title: Cloud Pub/Sub API

apis:
- name: google.iam.v1.IAMPolicy
- name: google.pubsub.v1.Publisher
- name: google.pubsub.v1.SchemaService
- name: google.pubsub.v1.Subscriber
- name: google.iam.v1.IAMPolicy

documentation:
summary: |-
Expand Down Expand Up @@ -42,7 +42,7 @@ backend:
- selector: 'google.pubsub.v1.Publisher.*'
deadline: 120.0
- selector: google.pubsub.v1.Publisher.Publish
deadline: 20.0
deadline: 25.0
- selector: 'google.pubsub.v1.Subscriber.*'
deadline: 120.0

Expand Down
2 changes: 1 addition & 1 deletion 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

0 comments on commit 8a4cc94

Please sign in to comment.