Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Commit 29d38a1

Browse files
feat: add BigQuery configuration for subscriptions (#1563)
* feat: add BigQuery configuration for subscriptions PiperOrigin-RevId: 449031535 Source-Link: googleapis/googleapis@feec34d Source-Link: googleapis/googleapis-gen@89664e9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODk2NjRlOTcwOGMxOWQ1MzJjNjNmN2ExNmZkNzljYjYzMWQ4N2FhMSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 518fce1 commit 29d38a1

5 files changed

Lines changed: 699 additions & 5 deletions

File tree

protos/google/pubsub/v1/pubsub.proto

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 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.
@@ -642,6 +642,20 @@ message Subscription {
642642
pattern: "projects/{project}/subscriptions/{subscription}"
643643
};
644644

645+
// Possible states for a subscription.
646+
enum State {
647+
// Default value. This value is unused.
648+
STATE_UNSPECIFIED = 0;
649+
650+
// The subscription can actively receive messages
651+
ACTIVE = 1;
652+
653+
// The subscription cannot receive messages because of an error with the
654+
// resource to which it pushes messages. See the more detailed error state
655+
// in the corresponding configuration.
656+
RESOURCE_ERROR = 2;
657+
}
658+
645659
// Required. The name of the subscription. It must have the format
646660
// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
647661
// start with a letter, and contain only letters (`[A-Za-z]`), numbers
@@ -659,10 +673,17 @@ message Subscription {
659673
];
660674

661675
// If push delivery is used with this subscription, this field is
662-
// used to configure it. An empty `pushConfig` signifies that the subscriber
663-
// will pull and ack messages using API methods.
676+
// used to configure it. Either `pushConfig` or `bigQueryConfig` can be set,
677+
// but not both. If both are empty, then the subscriber will pull and ack
678+
// messages using API methods.
664679
PushConfig push_config = 4;
665680

681+
// If delivery to BigQuery is used with this subscription, this field is
682+
// used to configure it. Either `pushConfig` or `bigQueryConfig` can be set,
683+
// but not both. If both are empty, then the subscriber will pull and ack
684+
// messages using API methods.
685+
BigQueryConfig bigquery_config = 18;
686+
666687
// The approximate amount of time (on a best-effort basis) Pub/Sub waits for
667688
// the subscriber to acknowledge receipt before resending the message. In the
668689
// interval after the message is delivered and before it is acknowledged, it
@@ -773,6 +794,10 @@ message Subscription {
773794
// in responses from the server; it is ignored if it is set in any requests.
774795
google.protobuf.Duration topic_message_retention_duration = 17
775796
[(google.api.field_behavior) = OUTPUT_ONLY];
797+
798+
// Output only. An output-only field indicating whether or not the subscription can receive
799+
// messages.
800+
State state = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
776801
}
777802

778803
// A policy that specifies how Cloud Pub/Sub retries message delivery.
@@ -902,6 +927,53 @@ message PushConfig {
902927
}
903928
}
904929

930+
// Configuration for a BigQuery subscription.
931+
message BigQueryConfig {
932+
// Possible states for a BigQuery subscription.
933+
enum State {
934+
// Default value. This value is unused.
935+
STATE_UNSPECIFIED = 0;
936+
937+
// The subscription can actively send messages to BigQuery
938+
ACTIVE = 1;
939+
940+
// Cannot write to the BigQuery table because of permission denied errors.
941+
PERMISSION_DENIED = 2;
942+
943+
// Cannot write to the BigQuery table because it does not exist.
944+
NOT_FOUND = 3;
945+
946+
// Cannot write to the BigQuery table due to a schema mismatch.
947+
SCHEMA_MISMATCH = 4;
948+
}
949+
950+
// The name of the table to which to write data, of the form
951+
// {projectId}:{datasetId}.{tableId}
952+
string table = 1;
953+
954+
// When true, use the topic's schema as the columns to write to in BigQuery,
955+
// if it exists.
956+
bool use_topic_schema = 2;
957+
958+
// When true, write the subscription name, message_id, publish_time,
959+
// attributes, and ordering_key to additional columns in the table. The
960+
// subscription name, message_id, and publish_time fields are put in their own
961+
// columns while all other message properties (other than data) are written to
962+
// a JSON object in the attributes column.
963+
bool write_metadata = 3;
964+
965+
// When true and use_topic_schema is true, any fields that are a part of the
966+
// topic schema that are not part of the BigQuery table schema are dropped
967+
// when writing to BigQuery. Otherwise, the schemas must be kept in sync and
968+
// any messages with extra fields are not written and remain in the
969+
// subscription's backlog.
970+
bool drop_unknown_fields = 4;
971+
972+
// Output only. An output-only field that indicates whether or not the subscription can
973+
// receive messages.
974+
State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
975+
}
976+
905977
// A message and its corresponding acknowledgment ID.
906978
message ReceivedMessage {
907979
// This ID can be used to acknowledge the received message.

protos/protos.d.ts

Lines changed: 148 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)