@@ -352,7 +352,7 @@ type TopicConfigToUpdate struct {
352
352
// data source into this topic.
353
353
//
354
354
// When changing this value, the entire data source settings object must be applied,
355
- // rather than just the differences.
355
+ // rather than just the differences. This includes the source and logging settings.
356
356
//
357
357
// Use the zero value &IngestionDataSourceSettings{} to remove the ingestion settings from the topic.
358
358
IngestionDataSourceSettings * IngestionDataSourceSettings
@@ -429,6 +429,8 @@ func messageStoragePolicyToProto(msp *MessageStoragePolicy) *pb.MessageStoragePo
429
429
// IngestionDataSourceSettings enables ingestion from a data source into this topic.
430
430
type IngestionDataSourceSettings struct {
431
431
Source IngestionDataSource
432
+
433
+ PlatformLogsSettings * PlatformLogsSettings
432
434
}
433
435
434
436
// IngestionDataSource is the kind of ingestion source to be used.
@@ -624,6 +626,13 @@ func protoToIngestionDataSourceSettings(pbs *pb.IngestionDataSourceSettings) *In
624
626
MatchGlob : cs .GetMatchGlob (),
625
627
}
626
628
}
629
+
630
+ if pbs .PlatformLogsSettings != nil {
631
+ s .PlatformLogsSettings = & PlatformLogsSettings {
632
+ Severity : PlatformLogsSeverity (pbs .PlatformLogsSettings .Severity ),
633
+ }
634
+ }
635
+
627
636
return s
628
637
}
629
638
@@ -636,6 +645,11 @@ func (i *IngestionDataSourceSettings) toProto() *pb.IngestionDataSourceSettings
636
645
return nil
637
646
}
638
647
pbs := & pb.IngestionDataSourceSettings {}
648
+ if i .PlatformLogsSettings != nil {
649
+ pbs .PlatformLogsSettings = & pb.PlatformLogsSettings {
650
+ Severity : pb .PlatformLogsSettings_Severity (i .PlatformLogsSettings .Severity ),
651
+ }
652
+ }
639
653
if out := i .Source ; out != nil {
640
654
if k , ok := out .(* IngestionDataSourceAWSKinesis ); ok {
641
655
pbs .Source = & pb.IngestionDataSourceSettings_AwsKinesis_ {
@@ -694,6 +708,30 @@ func (i *IngestionDataSourceSettings) toProto() *pb.IngestionDataSourceSettings
694
708
return pbs
695
709
}
696
710
711
+ // PlatformLogsSettings configures logging produced by Pub/Sub.
712
+ // Currently only valid on Cloud Storage ingestion topics.
713
+ type PlatformLogsSettings struct {
714
+ Severity PlatformLogsSeverity
715
+ }
716
+
717
+ // PlatformLogsSeverity are the severity levels of Platform Logs.
718
+ type PlatformLogsSeverity int32
719
+
720
+ const (
721
+ // PlatformLogsSeverityUnspecified is the default value. Logs level is unspecified. Logs will be disabled.
722
+ PlatformLogsSeverityUnspecified PlatformLogsSeverity = iota
723
+ // PlatformLogsSeverityDisabled means logs will be disabled.
724
+ PlatformLogsSeverityDisabled
725
+ // PlatformLogsSeverityDebug means debug logs and higher-severity logs will be written.
726
+ PlatformLogsSeverityDebug
727
+ // PlatformLogsSeverityInfo means info logs and higher-severity logs will be written.
728
+ PlatformLogsSeverityInfo
729
+ // PlatformLogsSeverityWarning means warning logs and higher-severity logs will be written.
730
+ PlatformLogsSeverityWarning
731
+ // PlatformLogsSeverityError means only error logs will be written.
732
+ PlatformLogsSeverityError
733
+ )
734
+
697
735
// Config returns the TopicConfig for the topic.
698
736
func (t * Topic ) Config (ctx context.Context ) (TopicConfig , error ) {
699
737
pbt , err := t .c .pubc .GetTopic (ctx , & pb.GetTopicRequest {Topic : t .name })
0 commit comments