Skip to content

Commit 5aac107

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Google PubSub destination to the Observability Pipelines API (#3364)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 9c89ced commit 5aac107

5 files changed

Lines changed: 576 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30324,6 +30324,7 @@ components:
3032430324
- $ref: '#/components/schemas/ObservabilityPipelineSocketDestination'
3032530325
- $ref: '#/components/schemas/ObservabilityPipelineAmazonSecurityLakeDestination'
3032630326
- $ref: '#/components/schemas/ObservabilityPipelineCrowdStrikeNextGenSiemDestination'
30327+
- $ref: '#/components/schemas/ObservabilityPipelineGooglePubSubDestination'
3032730328
ObservabilityPipelineConfigProcessorItem:
3032830329
description: A processor for the pipeline.
3032930330
oneOf:
@@ -31385,6 +31386,65 @@ components:
3138531386
type: string
3138631387
x-enum-varnames:
3138731388
- GOOGLE_CLOUD_STORAGE
31389+
ObservabilityPipelineGooglePubSubDestination:
31390+
description: The `google_pubsub` destination publishes logs to a Google Cloud
31391+
Pub/Sub topic.
31392+
properties:
31393+
auth:
31394+
$ref: '#/components/schemas/ObservabilityPipelineGcpAuth'
31395+
encoding:
31396+
$ref: '#/components/schemas/ObservabilityPipelineGooglePubSubDestinationEncoding'
31397+
id:
31398+
description: The unique identifier for this component.
31399+
example: google-pubsub-destination
31400+
type: string
31401+
inputs:
31402+
description: A list of component IDs whose output is used as the `input`
31403+
for this component.
31404+
example:
31405+
- filter-processor
31406+
items:
31407+
type: string
31408+
type: array
31409+
project:
31410+
description: The GCP project ID that owns the Pub/Sub topic.
31411+
example: my-gcp-project
31412+
type: string
31413+
tls:
31414+
$ref: '#/components/schemas/ObservabilityPipelineTls'
31415+
topic:
31416+
description: The Pub/Sub topic name to publish logs to.
31417+
example: logs-subscription
31418+
type: string
31419+
type:
31420+
$ref: '#/components/schemas/ObservabilityPipelineGooglePubSubDestinationType'
31421+
required:
31422+
- id
31423+
- type
31424+
- inputs
31425+
- encoding
31426+
- project
31427+
- topic
31428+
type: object
31429+
ObservabilityPipelineGooglePubSubDestinationEncoding:
31430+
description: Encoding format for log events.
31431+
enum:
31432+
- json
31433+
- raw_message
31434+
example: json
31435+
type: string
31436+
x-enum-varnames:
31437+
- JSON
31438+
- RAW_MESSAGE
31439+
ObservabilityPipelineGooglePubSubDestinationType:
31440+
default: google_pubsub
31441+
description: The destination type. The value should always be `google_pubsub`.
31442+
enum:
31443+
- google_pubsub
31444+
example: google_pubsub
31445+
type: string
31446+
x-enum-varnames:
31447+
- GOOGLE_PUBSUB
3138831448
ObservabilityPipelineGooglePubSubSource:
3138931449
description: The `google_pubsub` source ingests logs from a Google Cloud Pub/Sub
3139031450
subscription.

api/datadogV2/model_observability_pipeline_config_destination_item.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type ObservabilityPipelineConfigDestinationItem struct {
2828
ObservabilityPipelineSocketDestination *ObservabilityPipelineSocketDestination
2929
ObservabilityPipelineAmazonSecurityLakeDestination *ObservabilityPipelineAmazonSecurityLakeDestination
3030
ObservabilityPipelineCrowdStrikeNextGenSiemDestination *ObservabilityPipelineCrowdStrikeNextGenSiemDestination
31+
ObservabilityPipelineGooglePubSubDestination *ObservabilityPipelineGooglePubSubDestination
3132

3233
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
3334
UnparsedObject interface{}
@@ -123,6 +124,11 @@ func ObservabilityPipelineCrowdStrikeNextGenSiemDestinationAsObservabilityPipeli
123124
return ObservabilityPipelineConfigDestinationItem{ObservabilityPipelineCrowdStrikeNextGenSiemDestination: v}
124125
}
125126

127+
// ObservabilityPipelineGooglePubSubDestinationAsObservabilityPipelineConfigDestinationItem is a convenience function that returns ObservabilityPipelineGooglePubSubDestination wrapped in ObservabilityPipelineConfigDestinationItem.
128+
func ObservabilityPipelineGooglePubSubDestinationAsObservabilityPipelineConfigDestinationItem(v *ObservabilityPipelineGooglePubSubDestination) ObservabilityPipelineConfigDestinationItem {
129+
return ObservabilityPipelineConfigDestinationItem{ObservabilityPipelineGooglePubSubDestination: v}
130+
}
131+
126132
// UnmarshalJSON turns data into one of the pointers in the struct.
127133
func (obj *ObservabilityPipelineConfigDestinationItem) UnmarshalJSON(data []byte) error {
128134
var err error
@@ -433,6 +439,23 @@ func (obj *ObservabilityPipelineConfigDestinationItem) UnmarshalJSON(data []byte
433439
obj.ObservabilityPipelineCrowdStrikeNextGenSiemDestination = nil
434440
}
435441

442+
// try to unmarshal data into ObservabilityPipelineGooglePubSubDestination
443+
err = datadog.Unmarshal(data, &obj.ObservabilityPipelineGooglePubSubDestination)
444+
if err == nil {
445+
if obj.ObservabilityPipelineGooglePubSubDestination != nil && obj.ObservabilityPipelineGooglePubSubDestination.UnparsedObject == nil {
446+
jsonObservabilityPipelineGooglePubSubDestination, _ := datadog.Marshal(obj.ObservabilityPipelineGooglePubSubDestination)
447+
if string(jsonObservabilityPipelineGooglePubSubDestination) == "{}" { // empty struct
448+
obj.ObservabilityPipelineGooglePubSubDestination = nil
449+
} else {
450+
match++
451+
}
452+
} else {
453+
obj.ObservabilityPipelineGooglePubSubDestination = nil
454+
}
455+
} else {
456+
obj.ObservabilityPipelineGooglePubSubDestination = nil
457+
}
458+
436459
if match != 1 { // more than 1 match
437460
// reset to nil
438461
obj.ObservabilityPipelineDatadogLogsDestination = nil
@@ -453,6 +476,7 @@ func (obj *ObservabilityPipelineConfigDestinationItem) UnmarshalJSON(data []byte
453476
obj.ObservabilityPipelineSocketDestination = nil
454477
obj.ObservabilityPipelineAmazonSecurityLakeDestination = nil
455478
obj.ObservabilityPipelineCrowdStrikeNextGenSiemDestination = nil
479+
obj.ObservabilityPipelineGooglePubSubDestination = nil
456480
return datadog.Unmarshal(data, &obj.UnparsedObject)
457481
}
458482
return nil // exactly one match
@@ -532,6 +556,10 @@ func (obj ObservabilityPipelineConfigDestinationItem) MarshalJSON() ([]byte, err
532556
return datadog.Marshal(&obj.ObservabilityPipelineCrowdStrikeNextGenSiemDestination)
533557
}
534558

559+
if obj.ObservabilityPipelineGooglePubSubDestination != nil {
560+
return datadog.Marshal(&obj.ObservabilityPipelineGooglePubSubDestination)
561+
}
562+
535563
if obj.UnparsedObject != nil {
536564
return datadog.Marshal(obj.UnparsedObject)
537565
}
@@ -612,6 +640,10 @@ func (obj *ObservabilityPipelineConfigDestinationItem) GetActualInstance() inter
612640
return obj.ObservabilityPipelineCrowdStrikeNextGenSiemDestination
613641
}
614642

643+
if obj.ObservabilityPipelineGooglePubSubDestination != nil {
644+
return obj.ObservabilityPipelineGooglePubSubDestination
645+
}
646+
615647
// all schemas are nil
616648
return nil
617649
}

0 commit comments

Comments
 (0)