aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/cloud.google.com/go/pubsub/topic.go
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-07-25 07:50:36 +0000
committerTaras Madan <tarasmadan@google.com>2023-07-25 08:27:48 +0000
commitb423bd03401d00e754d5e5c0236feda4dfb02e28 (patch)
treeb4c5cb53485b00adb2877b7fa27b9b6e5f02552a /vendor/cloud.google.com/go/pubsub/topic.go
parente06c669f49a06146914b04a1fbbdd21a0bf1d7b1 (diff)
mod: do: bump golang.org/x/oauth2 from 0.5.0 to 0.10.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.5.0 to 0.10.0. - [Commits](https://github.com/golang/oauth2/compare/v0.5.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/oauth2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/cloud.google.com/go/pubsub/topic.go')
-rw-r--r--vendor/cloud.google.com/go/pubsub/topic.go33
1 files changed, 30 insertions, 3 deletions
diff --git a/vendor/cloud.google.com/go/pubsub/topic.go b/vendor/cloud.google.com/go/pubsub/topic.go
index 3073bd649..36af7d582 100644
--- a/vendor/cloud.google.com/go/pubsub/topic.go
+++ b/vendor/cloud.google.com/go/pubsub/topic.go
@@ -218,8 +218,7 @@ type TopicConfig struct {
// "projects/P/locations/L/keyRings/R/cryptoKeys/K".
KMSKeyName string
- // Schema defines the schema settings upon topic creation. This cannot
- // be modified after a topic has been created.
+ // Schema defines the schema settings upon topic creation.
SchemaSettings *SchemaSettings
// RetentionDuration configures the minimum duration to retain a message
@@ -292,6 +291,11 @@ type TopicConfigToUpdate struct {
// If set to a negative value, this clears RetentionDuration from the topic.
// If nil, the retention duration remains unchanged.
RetentionDuration optional.Duration
+
+ // Schema defines the schema settings upon topic creation.
+ //
+ // Use the zero value &SchemaSettings{} to remove the schema from the topic.
+ SchemaSettings *SchemaSettings
}
func protoToTopicConfig(pbt *pb.Topic) TopicConfig {
@@ -403,6 +407,30 @@ func (t *Topic) updateRequest(cfg TopicConfigToUpdate) *pb.UpdateTopicRequest {
}
paths = append(paths, "message_retention_duration")
}
+ if cfg.SchemaSettings != nil {
+ pt.SchemaSettings = schemaSettingsToProto(cfg.SchemaSettings)
+ clearSchema := true
+ if pt.SchemaSettings.Schema != "" {
+ paths = append(paths, "schema_settings.schema")
+ clearSchema = false
+ }
+ if pt.SchemaSettings.Encoding != pb.Encoding_ENCODING_UNSPECIFIED {
+ paths = append(paths, "schema_settings.encoding")
+ clearSchema = false
+ }
+ if pt.SchemaSettings.FirstRevisionId != "" {
+ paths = append(paths, "schema_settings.first_revision_id")
+ clearSchema = false
+ }
+ if pt.SchemaSettings.LastRevisionId != "" {
+ paths = append(paths, "schema_settings.last_revision_id")
+ clearSchema = false
+ }
+ // Clear the schema if none of it's value changes.
+ if clearSchema {
+ paths = append(paths, "schema_settings")
+ }
+ }
return &pb.UpdateTopicRequest{
Topic: pt,
UpdateMask: &fmpb.FieldMask{Paths: paths},
@@ -565,7 +593,6 @@ func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult {
}
err = t.scheduler.Add(msg.OrderingKey, &bundledMessage{msg, r, msgSize}, msgSize)
if err != nil {
- fmt.Printf("got err: %v\n", err)
t.scheduler.Pause(msg.OrderingKey)
ipubsub.SetPublishResult(r, "", err)
}