Skip to content

Commit b2478aa

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Make google auth optional for Observability Pipelines (#3476)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent d6ac218 commit b2478aa

File tree

4 files changed

+83
-75
lines changed

4 files changed

+83
-75
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34514,7 +34514,6 @@ components:
3451434514
- id
3451534515
- type
3451634516
- inputs
34517-
- auth
3451834517
- customer_id
3451934518
type: object
3452034519
ObservabilityPipelineGoogleChronicleDestinationEncoding:
@@ -34580,9 +34579,7 @@ components:
3458034579
- type
3458134580
- inputs
3458234581
- bucket
34583-
- auth
3458434582
- storage_class
34585-
- acl
3458634583
type: object
3458734584
ObservabilityPipelineGoogleCloudStorageDestinationAcl:
3458834585
description: Access control list setting for objects written to the bucket.
@@ -34713,7 +34710,6 @@ components:
3471334710
required:
3471434711
- id
3471534712
- type
34716-
- auth
3471734713
- decoding
3471834714
- project
3471934715
- subscription

api/datadogV2/model_observability_pipeline_google_chronicle_destination.go

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// ObservabilityPipelineGoogleChronicleDestination The `google_chronicle` destination sends logs to Google Chronicle.
1414
type ObservabilityPipelineGoogleChronicleDestination struct {
1515
// GCP credentials used to authenticate with Google Cloud Storage.
16-
Auth ObservabilityPipelineGcpAuth `json:"auth"`
16+
Auth *ObservabilityPipelineGcpAuth `json:"auth,omitempty"`
1717
// The Google Chronicle customer ID.
1818
CustomerId string `json:"customer_id"`
1919
// The encoding format for the logs sent to Chronicle.
@@ -35,9 +35,8 @@ type ObservabilityPipelineGoogleChronicleDestination struct {
3535
// This constructor will assign default values to properties that have it defined,
3636
// and makes sure properties required by API are set, but the set of arguments
3737
// will change when the set of required properties is changed.
38-
func NewObservabilityPipelineGoogleChronicleDestination(auth ObservabilityPipelineGcpAuth, customerId string, id string, inputs []string, typeVar ObservabilityPipelineGoogleChronicleDestinationType) *ObservabilityPipelineGoogleChronicleDestination {
38+
func NewObservabilityPipelineGoogleChronicleDestination(customerId string, id string, inputs []string, typeVar ObservabilityPipelineGoogleChronicleDestinationType) *ObservabilityPipelineGoogleChronicleDestination {
3939
this := ObservabilityPipelineGoogleChronicleDestination{}
40-
this.Auth = auth
4140
this.CustomerId = customerId
4241
this.Id = id
4342
this.Inputs = inputs
@@ -55,27 +54,32 @@ func NewObservabilityPipelineGoogleChronicleDestinationWithDefaults() *Observabi
5554
return &this
5655
}
5756

58-
// GetAuth returns the Auth field value.
57+
// GetAuth returns the Auth field value if set, zero value otherwise.
5958
func (o *ObservabilityPipelineGoogleChronicleDestination) GetAuth() ObservabilityPipelineGcpAuth {
60-
if o == nil {
59+
if o == nil || o.Auth == nil {
6160
var ret ObservabilityPipelineGcpAuth
6261
return ret
6362
}
64-
return o.Auth
63+
return *o.Auth
6564
}
6665

67-
// GetAuthOk returns a tuple with the Auth field value
66+
// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise
6867
// and a boolean to check if the value has been set.
6968
func (o *ObservabilityPipelineGoogleChronicleDestination) GetAuthOk() (*ObservabilityPipelineGcpAuth, bool) {
70-
if o == nil {
69+
if o == nil || o.Auth == nil {
7170
return nil, false
7271
}
73-
return &o.Auth, true
72+
return o.Auth, true
73+
}
74+
75+
// HasAuth returns a boolean if a field has been set.
76+
func (o *ObservabilityPipelineGoogleChronicleDestination) HasAuth() bool {
77+
return o != nil && o.Auth != nil
7478
}
7579

76-
// SetAuth sets field value.
80+
// SetAuth gets a reference to the given ObservabilityPipelineGcpAuth and assigns it to the Auth field.
7781
func (o *ObservabilityPipelineGoogleChronicleDestination) SetAuth(v ObservabilityPipelineGcpAuth) {
78-
o.Auth = v
82+
o.Auth = &v
7983
}
8084

8185
// GetCustomerId returns the CustomerId field value.
@@ -232,7 +236,9 @@ func (o ObservabilityPipelineGoogleChronicleDestination) MarshalJSON() ([]byte,
232236
if o.UnparsedObject != nil {
233237
return datadog.Marshal(o.UnparsedObject)
234238
}
235-
toSerialize["auth"] = o.Auth
239+
if o.Auth != nil {
240+
toSerialize["auth"] = o.Auth
241+
}
236242
toSerialize["customer_id"] = o.CustomerId
237243
if o.Encoding != nil {
238244
toSerialize["encoding"] = o.Encoding
@@ -253,7 +259,7 @@ func (o ObservabilityPipelineGoogleChronicleDestination) MarshalJSON() ([]byte,
253259
// UnmarshalJSON deserializes the given payload.
254260
func (o *ObservabilityPipelineGoogleChronicleDestination) UnmarshalJSON(bytes []byte) (err error) {
255261
all := struct {
256-
Auth *ObservabilityPipelineGcpAuth `json:"auth"`
262+
Auth *ObservabilityPipelineGcpAuth `json:"auth,omitempty"`
257263
CustomerId *string `json:"customer_id"`
258264
Encoding *ObservabilityPipelineGoogleChronicleDestinationEncoding `json:"encoding,omitempty"`
259265
Id *string `json:"id"`
@@ -264,9 +270,6 @@ func (o *ObservabilityPipelineGoogleChronicleDestination) UnmarshalJSON(bytes []
264270
if err = datadog.Unmarshal(bytes, &all); err != nil {
265271
return datadog.Unmarshal(bytes, &o.UnparsedObject)
266272
}
267-
if all.Auth == nil {
268-
return fmt.Errorf("required field auth missing")
269-
}
270273
if all.CustomerId == nil {
271274
return fmt.Errorf("required field customer_id missing")
272275
}
@@ -287,10 +290,10 @@ func (o *ObservabilityPipelineGoogleChronicleDestination) UnmarshalJSON(bytes []
287290
}
288291

289292
hasInvalidField := false
290-
if all.Auth.UnparsedObject != nil && o.UnparsedObject == nil {
293+
if all.Auth != nil && all.Auth.UnparsedObject != nil && o.UnparsedObject == nil {
291294
hasInvalidField = true
292295
}
293-
o.Auth = *all.Auth
296+
o.Auth = all.Auth
294297
o.CustomerId = *all.CustomerId
295298
if all.Encoding != nil && !all.Encoding.IsValid() {
296299
hasInvalidField = true

api/datadogV2/model_observability_pipeline_google_cloud_storage_destination.go

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
// It requires a bucket name, GCP authentication, and metadata fields.
1515
type ObservabilityPipelineGoogleCloudStorageDestination struct {
1616
// Access control list setting for objects written to the bucket.
17-
Acl ObservabilityPipelineGoogleCloudStorageDestinationAcl `json:"acl"`
17+
Acl *ObservabilityPipelineGoogleCloudStorageDestinationAcl `json:"acl,omitempty"`
1818
// GCP credentials used to authenticate with Google Cloud Storage.
19-
Auth ObservabilityPipelineGcpAuth `json:"auth"`
19+
Auth *ObservabilityPipelineGcpAuth `json:"auth,omitempty"`
2020
// Name of the GCS bucket.
2121
Bucket string `json:"bucket"`
2222
// Unique identifier for the destination component.
@@ -40,10 +40,8 @@ type ObservabilityPipelineGoogleCloudStorageDestination struct {
4040
// This constructor will assign default values to properties that have it defined,
4141
// and makes sure properties required by API are set, but the set of arguments
4242
// will change when the set of required properties is changed.
43-
func NewObservabilityPipelineGoogleCloudStorageDestination(acl ObservabilityPipelineGoogleCloudStorageDestinationAcl, auth ObservabilityPipelineGcpAuth, bucket string, id string, inputs []string, storageClass ObservabilityPipelineGoogleCloudStorageDestinationStorageClass, typeVar ObservabilityPipelineGoogleCloudStorageDestinationType) *ObservabilityPipelineGoogleCloudStorageDestination {
43+
func NewObservabilityPipelineGoogleCloudStorageDestination(bucket string, id string, inputs []string, storageClass ObservabilityPipelineGoogleCloudStorageDestinationStorageClass, typeVar ObservabilityPipelineGoogleCloudStorageDestinationType) *ObservabilityPipelineGoogleCloudStorageDestination {
4444
this := ObservabilityPipelineGoogleCloudStorageDestination{}
45-
this.Acl = acl
46-
this.Auth = auth
4745
this.Bucket = bucket
4846
this.Id = id
4947
this.Inputs = inputs
@@ -62,50 +60,60 @@ func NewObservabilityPipelineGoogleCloudStorageDestinationWithDefaults() *Observ
6260
return &this
6361
}
6462

65-
// GetAcl returns the Acl field value.
63+
// GetAcl returns the Acl field value if set, zero value otherwise.
6664
func (o *ObservabilityPipelineGoogleCloudStorageDestination) GetAcl() ObservabilityPipelineGoogleCloudStorageDestinationAcl {
67-
if o == nil {
65+
if o == nil || o.Acl == nil {
6866
var ret ObservabilityPipelineGoogleCloudStorageDestinationAcl
6967
return ret
7068
}
71-
return o.Acl
69+
return *o.Acl
7270
}
7371

74-
// GetAclOk returns a tuple with the Acl field value
72+
// GetAclOk returns a tuple with the Acl field value if set, nil otherwise
7573
// and a boolean to check if the value has been set.
7674
func (o *ObservabilityPipelineGoogleCloudStorageDestination) GetAclOk() (*ObservabilityPipelineGoogleCloudStorageDestinationAcl, bool) {
77-
if o == nil {
75+
if o == nil || o.Acl == nil {
7876
return nil, false
7977
}
80-
return &o.Acl, true
78+
return o.Acl, true
79+
}
80+
81+
// HasAcl returns a boolean if a field has been set.
82+
func (o *ObservabilityPipelineGoogleCloudStorageDestination) HasAcl() bool {
83+
return o != nil && o.Acl != nil
8184
}
8285

83-
// SetAcl sets field value.
86+
// SetAcl gets a reference to the given ObservabilityPipelineGoogleCloudStorageDestinationAcl and assigns it to the Acl field.
8487
func (o *ObservabilityPipelineGoogleCloudStorageDestination) SetAcl(v ObservabilityPipelineGoogleCloudStorageDestinationAcl) {
85-
o.Acl = v
88+
o.Acl = &v
8689
}
8790

88-
// GetAuth returns the Auth field value.
91+
// GetAuth returns the Auth field value if set, zero value otherwise.
8992
func (o *ObservabilityPipelineGoogleCloudStorageDestination) GetAuth() ObservabilityPipelineGcpAuth {
90-
if o == nil {
93+
if o == nil || o.Auth == nil {
9194
var ret ObservabilityPipelineGcpAuth
9295
return ret
9396
}
94-
return o.Auth
97+
return *o.Auth
9598
}
9699

97-
// GetAuthOk returns a tuple with the Auth field value
100+
// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise
98101
// and a boolean to check if the value has been set.
99102
func (o *ObservabilityPipelineGoogleCloudStorageDestination) GetAuthOk() (*ObservabilityPipelineGcpAuth, bool) {
100-
if o == nil {
103+
if o == nil || o.Auth == nil {
101104
return nil, false
102105
}
103-
return &o.Auth, true
106+
return o.Auth, true
104107
}
105108

106-
// SetAuth sets field value.
109+
// HasAuth returns a boolean if a field has been set.
110+
func (o *ObservabilityPipelineGoogleCloudStorageDestination) HasAuth() bool {
111+
return o != nil && o.Auth != nil
112+
}
113+
114+
// SetAuth gets a reference to the given ObservabilityPipelineGcpAuth and assigns it to the Auth field.
107115
func (o *ObservabilityPipelineGoogleCloudStorageDestination) SetAuth(v ObservabilityPipelineGcpAuth) {
108-
o.Auth = v
116+
o.Auth = &v
109117
}
110118

111119
// GetBucket returns the Bucket field value.
@@ -285,8 +293,12 @@ func (o ObservabilityPipelineGoogleCloudStorageDestination) MarshalJSON() ([]byt
285293
if o.UnparsedObject != nil {
286294
return datadog.Marshal(o.UnparsedObject)
287295
}
288-
toSerialize["acl"] = o.Acl
289-
toSerialize["auth"] = o.Auth
296+
if o.Acl != nil {
297+
toSerialize["acl"] = o.Acl
298+
}
299+
if o.Auth != nil {
300+
toSerialize["auth"] = o.Auth
301+
}
290302
toSerialize["bucket"] = o.Bucket
291303
toSerialize["id"] = o.Id
292304
toSerialize["inputs"] = o.Inputs
@@ -308,8 +320,8 @@ func (o ObservabilityPipelineGoogleCloudStorageDestination) MarshalJSON() ([]byt
308320
// UnmarshalJSON deserializes the given payload.
309321
func (o *ObservabilityPipelineGoogleCloudStorageDestination) UnmarshalJSON(bytes []byte) (err error) {
310322
all := struct {
311-
Acl *ObservabilityPipelineGoogleCloudStorageDestinationAcl `json:"acl"`
312-
Auth *ObservabilityPipelineGcpAuth `json:"auth"`
323+
Acl *ObservabilityPipelineGoogleCloudStorageDestinationAcl `json:"acl,omitempty"`
324+
Auth *ObservabilityPipelineGcpAuth `json:"auth,omitempty"`
313325
Bucket *string `json:"bucket"`
314326
Id *string `json:"id"`
315327
Inputs *[]string `json:"inputs"`
@@ -321,12 +333,6 @@ func (o *ObservabilityPipelineGoogleCloudStorageDestination) UnmarshalJSON(bytes
321333
if err = datadog.Unmarshal(bytes, &all); err != nil {
322334
return datadog.Unmarshal(bytes, &o.UnparsedObject)
323335
}
324-
if all.Acl == nil {
325-
return fmt.Errorf("required field acl missing")
326-
}
327-
if all.Auth == nil {
328-
return fmt.Errorf("required field auth missing")
329-
}
330336
if all.Bucket == nil {
331337
return fmt.Errorf("required field bucket missing")
332338
}
@@ -350,15 +356,15 @@ func (o *ObservabilityPipelineGoogleCloudStorageDestination) UnmarshalJSON(bytes
350356
}
351357

352358
hasInvalidField := false
353-
if !all.Acl.IsValid() {
359+
if all.Acl != nil && !all.Acl.IsValid() {
354360
hasInvalidField = true
355361
} else {
356-
o.Acl = *all.Acl
362+
o.Acl = all.Acl
357363
}
358-
if all.Auth.UnparsedObject != nil && o.UnparsedObject == nil {
364+
if all.Auth != nil && all.Auth.UnparsedObject != nil && o.UnparsedObject == nil {
359365
hasInvalidField = true
360366
}
361-
o.Auth = *all.Auth
367+
o.Auth = all.Auth
362368
o.Bucket = *all.Bucket
363369
o.Id = *all.Id
364370
o.Inputs = *all.Inputs

api/datadogV2/model_observability_pipeline_google_pub_sub_source.go

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// ObservabilityPipelineGooglePubSubSource The `google_pubsub` source ingests logs from a Google Cloud Pub/Sub subscription.
1414
type ObservabilityPipelineGooglePubSubSource struct {
1515
// GCP credentials used to authenticate with Google Cloud Storage.
16-
Auth ObservabilityPipelineGcpAuth `json:"auth"`
16+
Auth *ObservabilityPipelineGcpAuth `json:"auth,omitempty"`
1717
// The decoding format used to interpret incoming logs.
1818
Decoding ObservabilityPipelineDecoding `json:"decoding"`
1919
// The unique identifier for this component. Used to reference this component in other parts of the pipeline (e.g., as input to downstream components).
@@ -35,9 +35,8 @@ type ObservabilityPipelineGooglePubSubSource struct {
3535
// This constructor will assign default values to properties that have it defined,
3636
// and makes sure properties required by API are set, but the set of arguments
3737
// will change when the set of required properties is changed.
38-
func NewObservabilityPipelineGooglePubSubSource(auth ObservabilityPipelineGcpAuth, decoding ObservabilityPipelineDecoding, id string, project string, subscription string, typeVar ObservabilityPipelineGooglePubSubSourceType) *ObservabilityPipelineGooglePubSubSource {
38+
func NewObservabilityPipelineGooglePubSubSource(decoding ObservabilityPipelineDecoding, id string, project string, subscription string, typeVar ObservabilityPipelineGooglePubSubSourceType) *ObservabilityPipelineGooglePubSubSource {
3939
this := ObservabilityPipelineGooglePubSubSource{}
40-
this.Auth = auth
4140
this.Decoding = decoding
4241
this.Id = id
4342
this.Project = project
@@ -56,27 +55,32 @@ func NewObservabilityPipelineGooglePubSubSourceWithDefaults() *ObservabilityPipe
5655
return &this
5756
}
5857

59-
// GetAuth returns the Auth field value.
58+
// GetAuth returns the Auth field value if set, zero value otherwise.
6059
func (o *ObservabilityPipelineGooglePubSubSource) GetAuth() ObservabilityPipelineGcpAuth {
61-
if o == nil {
60+
if o == nil || o.Auth == nil {
6261
var ret ObservabilityPipelineGcpAuth
6362
return ret
6463
}
65-
return o.Auth
64+
return *o.Auth
6665
}
6766

68-
// GetAuthOk returns a tuple with the Auth field value
67+
// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise
6968
// and a boolean to check if the value has been set.
7069
func (o *ObservabilityPipelineGooglePubSubSource) GetAuthOk() (*ObservabilityPipelineGcpAuth, bool) {
71-
if o == nil {
70+
if o == nil || o.Auth == nil {
7271
return nil, false
7372
}
74-
return &o.Auth, true
73+
return o.Auth, true
74+
}
75+
76+
// HasAuth returns a boolean if a field has been set.
77+
func (o *ObservabilityPipelineGooglePubSubSource) HasAuth() bool {
78+
return o != nil && o.Auth != nil
7579
}
7680

77-
// SetAuth sets field value.
81+
// SetAuth gets a reference to the given ObservabilityPipelineGcpAuth and assigns it to the Auth field.
7882
func (o *ObservabilityPipelineGooglePubSubSource) SetAuth(v ObservabilityPipelineGcpAuth) {
79-
o.Auth = v
83+
o.Auth = &v
8084
}
8185

8286
// GetDecoding returns the Decoding field value.
@@ -228,7 +232,9 @@ func (o ObservabilityPipelineGooglePubSubSource) MarshalJSON() ([]byte, error) {
228232
if o.UnparsedObject != nil {
229233
return datadog.Marshal(o.UnparsedObject)
230234
}
231-
toSerialize["auth"] = o.Auth
235+
if o.Auth != nil {
236+
toSerialize["auth"] = o.Auth
237+
}
232238
toSerialize["decoding"] = o.Decoding
233239
toSerialize["id"] = o.Id
234240
toSerialize["project"] = o.Project
@@ -247,7 +253,7 @@ func (o ObservabilityPipelineGooglePubSubSource) MarshalJSON() ([]byte, error) {
247253
// UnmarshalJSON deserializes the given payload.
248254
func (o *ObservabilityPipelineGooglePubSubSource) UnmarshalJSON(bytes []byte) (err error) {
249255
all := struct {
250-
Auth *ObservabilityPipelineGcpAuth `json:"auth"`
256+
Auth *ObservabilityPipelineGcpAuth `json:"auth,omitempty"`
251257
Decoding *ObservabilityPipelineDecoding `json:"decoding"`
252258
Id *string `json:"id"`
253259
Project *string `json:"project"`
@@ -258,9 +264,6 @@ func (o *ObservabilityPipelineGooglePubSubSource) UnmarshalJSON(bytes []byte) (e
258264
if err = datadog.Unmarshal(bytes, &all); err != nil {
259265
return datadog.Unmarshal(bytes, &o.UnparsedObject)
260266
}
261-
if all.Auth == nil {
262-
return fmt.Errorf("required field auth missing")
263-
}
264267
if all.Decoding == nil {
265268
return fmt.Errorf("required field decoding missing")
266269
}
@@ -284,10 +287,10 @@ func (o *ObservabilityPipelineGooglePubSubSource) UnmarshalJSON(bytes []byte) (e
284287
}
285288

286289
hasInvalidField := false
287-
if all.Auth.UnparsedObject != nil && o.UnparsedObject == nil {
290+
if all.Auth != nil && all.Auth.UnparsedObject != nil && o.UnparsedObject == nil {
288291
hasInvalidField = true
289292
}
290-
o.Auth = *all.Auth
293+
o.Auth = all.Auth
291294
if !all.Decoding.IsValid() {
292295
hasInvalidField = true
293296
} else {

0 commit comments

Comments
 (0)