Skip to content

Commit 85431be

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add compression_method field to Log Archives (#4021)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent d1edbb3 commit 85431be

7 files changed

Lines changed: 197 additions & 20 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41615,6 +41615,8 @@ components:
4161541615
LogsArchiveAttributes:
4161641616
description: The attributes associated with the archive.
4161741617
properties:
41618+
compression_method:
41619+
$ref: "#/components/schemas/LogsArchiveAttributesCompressionMethod"
4161841620
destination:
4161941621
$ref: "#/components/schemas/LogsArchiveDestination"
4162041622
include_tags:
@@ -41652,6 +41654,17 @@ components:
4165241654
- query
4165341655
- destination
4165441656
type: object
41657+
LogsArchiveAttributesCompressionMethod:
41658+
default: GZIP
41659+
description: The type of compression for the archive.
41660+
enum:
41661+
- GZIP
41662+
- ZSTD
41663+
example: GZIP
41664+
type: string
41665+
x-enum-varnames:
41666+
- GZIP
41667+
- ZSTD
4165541668
LogsArchiveCreateRequest:
4165641669
description: The logs archive.
4165741670
properties:
@@ -41661,6 +41674,8 @@ components:
4166141674
LogsArchiveCreateRequestAttributes:
4166241675
description: The attributes associated with the archive.
4166341676
properties:
41677+
compression_method:
41678+
$ref: "#/components/schemas/LogsArchiveAttributesCompressionMethod"
4166441679
destination:
4166541680
$ref: "#/components/schemas/LogsArchiveCreateRequestDestination"
4166641681
include_tags:
@@ -111745,6 +111760,7 @@ paths:
111745111760
value:
111746111761
data:
111747111762
attributes:
111763+
compression_method: GZIP
111748111764
destination:
111749111765
container: container-name
111750111766
storage_account: account-name
@@ -111918,6 +111934,7 @@ paths:
111918111934
value:
111919111935
data:
111920111936
attributes:
111937+
compression_method: GZIP
111921111938
destination:
111922111939
container: container-name
111923111940
storage_account: account-name

api/datadogV2/model_logs_archive_attributes.go

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212

1313
// LogsArchiveAttributes The attributes associated with the archive.
1414
type LogsArchiveAttributes struct {
15+
// The type of compression for the archive.
16+
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
1517
// An archive's destination.
1618
Destination NullableLogsArchiveDestination `json:"destination"`
1719
// To store the tags in the archive, set the value "true".
@@ -38,6 +40,8 @@ type LogsArchiveAttributes struct {
3840
// will change when the set of required properties is changed.
3941
func NewLogsArchiveAttributes(destination NullableLogsArchiveDestination, name string, query string) *LogsArchiveAttributes {
4042
this := LogsArchiveAttributes{}
43+
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
44+
this.CompressionMethod = &compressionMethod
4145
this.Destination = destination
4246
var includeTags bool = false
4347
this.IncludeTags = &includeTags
@@ -51,11 +55,41 @@ func NewLogsArchiveAttributes(destination NullableLogsArchiveDestination, name s
5155
// but it doesn't guarantee that properties required by API are set.
5256
func NewLogsArchiveAttributesWithDefaults() *LogsArchiveAttributes {
5357
this := LogsArchiveAttributes{}
58+
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
59+
this.CompressionMethod = &compressionMethod
5460
var includeTags bool = false
5561
this.IncludeTags = &includeTags
5662
return &this
5763
}
5864

65+
// GetCompressionMethod returns the CompressionMethod field value if set, zero value otherwise.
66+
func (o *LogsArchiveAttributes) GetCompressionMethod() LogsArchiveAttributesCompressionMethod {
67+
if o == nil || o.CompressionMethod == nil {
68+
var ret LogsArchiveAttributesCompressionMethod
69+
return ret
70+
}
71+
return *o.CompressionMethod
72+
}
73+
74+
// GetCompressionMethodOk returns a tuple with the CompressionMethod field value if set, nil otherwise
75+
// and a boolean to check if the value has been set.
76+
func (o *LogsArchiveAttributes) GetCompressionMethodOk() (*LogsArchiveAttributesCompressionMethod, bool) {
77+
if o == nil || o.CompressionMethod == nil {
78+
return nil, false
79+
}
80+
return o.CompressionMethod, true
81+
}
82+
83+
// HasCompressionMethod returns a boolean if a field has been set.
84+
func (o *LogsArchiveAttributes) HasCompressionMethod() bool {
85+
return o != nil && o.CompressionMethod != nil
86+
}
87+
88+
// SetCompressionMethod gets a reference to the given LogsArchiveAttributesCompressionMethod and assigns it to the CompressionMethod field.
89+
func (o *LogsArchiveAttributes) SetCompressionMethod(v LogsArchiveAttributesCompressionMethod) {
90+
o.CompressionMethod = &v
91+
}
92+
5993
// GetDestination returns the Destination field value.
6094
// If the value is explicit nil, the zero value for LogsArchiveDestination will be returned.
6195
func (o *LogsArchiveAttributes) GetDestination() LogsArchiveDestination {
@@ -256,6 +290,9 @@ func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) {
256290
if o.UnparsedObject != nil {
257291
return datadog.Marshal(o.UnparsedObject)
258292
}
293+
if o.CompressionMethod != nil {
294+
toSerialize["compression_method"] = o.CompressionMethod
295+
}
259296
toSerialize["destination"] = o.Destination.Get()
260297
if o.IncludeTags != nil {
261298
toSerialize["include_tags"] = o.IncludeTags
@@ -281,13 +318,14 @@ func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) {
281318
// UnmarshalJSON deserializes the given payload.
282319
func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) {
283320
all := struct {
284-
Destination NullableLogsArchiveDestination `json:"destination"`
285-
IncludeTags *bool `json:"include_tags,omitempty"`
286-
Name *string `json:"name"`
287-
Query *string `json:"query"`
288-
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
289-
RehydrationTags []string `json:"rehydration_tags,omitempty"`
290-
State *LogsArchiveState `json:"state,omitempty"`
321+
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
322+
Destination NullableLogsArchiveDestination `json:"destination"`
323+
IncludeTags *bool `json:"include_tags,omitempty"`
324+
Name *string `json:"name"`
325+
Query *string `json:"query"`
326+
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
327+
RehydrationTags []string `json:"rehydration_tags,omitempty"`
328+
State *LogsArchiveState `json:"state,omitempty"`
291329
}{}
292330
if err = datadog.Unmarshal(bytes, &all); err != nil {
293331
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -303,12 +341,17 @@ func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) {
303341
}
304342
additionalProperties := make(map[string]interface{})
305343
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
306-
datadog.DeleteKeys(additionalProperties, &[]string{"destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags", "state"})
344+
datadog.DeleteKeys(additionalProperties, &[]string{"compression_method", "destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags", "state"})
307345
} else {
308346
return err
309347
}
310348

311349
hasInvalidField := false
350+
if all.CompressionMethod != nil && !all.CompressionMethod.IsValid() {
351+
hasInvalidField = true
352+
} else {
353+
o.CompressionMethod = all.CompressionMethod
354+
}
312355
o.Destination = all.Destination
313356
o.IncludeTags = all.IncludeTags
314357
o.Name = *all.Name
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// LogsArchiveAttributesCompressionMethod The type of compression for the archive.
14+
type LogsArchiveAttributesCompressionMethod string
15+
16+
// List of LogsArchiveAttributesCompressionMethod.
17+
const (
18+
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP LogsArchiveAttributesCompressionMethod = "GZIP"
19+
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_ZSTD LogsArchiveAttributesCompressionMethod = "ZSTD"
20+
)
21+
22+
var allowedLogsArchiveAttributesCompressionMethodEnumValues = []LogsArchiveAttributesCompressionMethod{
23+
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP,
24+
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_ZSTD,
25+
}
26+
27+
// GetAllowedValues reeturns the list of possible values.
28+
func (v *LogsArchiveAttributesCompressionMethod) GetAllowedValues() []LogsArchiveAttributesCompressionMethod {
29+
return allowedLogsArchiveAttributesCompressionMethodEnumValues
30+
}
31+
32+
// UnmarshalJSON deserializes the given payload.
33+
func (v *LogsArchiveAttributesCompressionMethod) UnmarshalJSON(src []byte) error {
34+
var value string
35+
err := datadog.Unmarshal(src, &value)
36+
if err != nil {
37+
return err
38+
}
39+
*v = LogsArchiveAttributesCompressionMethod(value)
40+
return nil
41+
}
42+
43+
// NewLogsArchiveAttributesCompressionMethodFromValue returns a pointer to a valid LogsArchiveAttributesCompressionMethod
44+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
45+
func NewLogsArchiveAttributesCompressionMethodFromValue(v string) (*LogsArchiveAttributesCompressionMethod, error) {
46+
ev := LogsArchiveAttributesCompressionMethod(v)
47+
if ev.IsValid() {
48+
return &ev, nil
49+
}
50+
return nil, fmt.Errorf("invalid value '%v' for LogsArchiveAttributesCompressionMethod: valid values are %v", v, allowedLogsArchiveAttributesCompressionMethodEnumValues)
51+
}
52+
53+
// IsValid return true if the value is valid for the enum, false otherwise.
54+
func (v LogsArchiveAttributesCompressionMethod) IsValid() bool {
55+
for _, existing := range allowedLogsArchiveAttributesCompressionMethodEnumValues {
56+
if existing == v {
57+
return true
58+
}
59+
}
60+
return false
61+
}
62+
63+
// Ptr returns reference to LogsArchiveAttributesCompressionMethod value.
64+
func (v LogsArchiveAttributesCompressionMethod) Ptr() *LogsArchiveAttributesCompressionMethod {
65+
return &v
66+
}

api/datadogV2/model_logs_archive_create_request_attributes.go

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212

1313
// LogsArchiveCreateRequestAttributes The attributes associated with the archive.
1414
type LogsArchiveCreateRequestAttributes struct {
15+
// The type of compression for the archive.
16+
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
1517
// An archive's destination.
1618
Destination LogsArchiveCreateRequestDestination `json:"destination"`
1719
// To store the tags in the archive, set the value "true".
@@ -36,6 +38,8 @@ type LogsArchiveCreateRequestAttributes struct {
3638
// will change when the set of required properties is changed.
3739
func NewLogsArchiveCreateRequestAttributes(destination LogsArchiveCreateRequestDestination, name string, query string) *LogsArchiveCreateRequestAttributes {
3840
this := LogsArchiveCreateRequestAttributes{}
41+
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
42+
this.CompressionMethod = &compressionMethod
3943
this.Destination = destination
4044
var includeTags bool = false
4145
this.IncludeTags = &includeTags
@@ -49,11 +53,41 @@ func NewLogsArchiveCreateRequestAttributes(destination LogsArchiveCreateRequestD
4953
// but it doesn't guarantee that properties required by API are set.
5054
func NewLogsArchiveCreateRequestAttributesWithDefaults() *LogsArchiveCreateRequestAttributes {
5155
this := LogsArchiveCreateRequestAttributes{}
56+
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
57+
this.CompressionMethod = &compressionMethod
5258
var includeTags bool = false
5359
this.IncludeTags = &includeTags
5460
return &this
5561
}
5662

63+
// GetCompressionMethod returns the CompressionMethod field value if set, zero value otherwise.
64+
func (o *LogsArchiveCreateRequestAttributes) GetCompressionMethod() LogsArchiveAttributesCompressionMethod {
65+
if o == nil || o.CompressionMethod == nil {
66+
var ret LogsArchiveAttributesCompressionMethod
67+
return ret
68+
}
69+
return *o.CompressionMethod
70+
}
71+
72+
// GetCompressionMethodOk returns a tuple with the CompressionMethod field value if set, nil otherwise
73+
// and a boolean to check if the value has been set.
74+
func (o *LogsArchiveCreateRequestAttributes) GetCompressionMethodOk() (*LogsArchiveAttributesCompressionMethod, bool) {
75+
if o == nil || o.CompressionMethod == nil {
76+
return nil, false
77+
}
78+
return o.CompressionMethod, true
79+
}
80+
81+
// HasCompressionMethod returns a boolean if a field has been set.
82+
func (o *LogsArchiveCreateRequestAttributes) HasCompressionMethod() bool {
83+
return o != nil && o.CompressionMethod != nil
84+
}
85+
86+
// SetCompressionMethod gets a reference to the given LogsArchiveAttributesCompressionMethod and assigns it to the CompressionMethod field.
87+
func (o *LogsArchiveCreateRequestAttributes) SetCompressionMethod(v LogsArchiveAttributesCompressionMethod) {
88+
o.CompressionMethod = &v
89+
}
90+
5791
// GetDestination returns the Destination field value.
5892
func (o *LogsArchiveCreateRequestAttributes) GetDestination() LogsArchiveCreateRequestDestination {
5993
if o == nil {
@@ -224,6 +258,9 @@ func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) {
224258
if o.UnparsedObject != nil {
225259
return datadog.Marshal(o.UnparsedObject)
226260
}
261+
if o.CompressionMethod != nil {
262+
toSerialize["compression_method"] = o.CompressionMethod
263+
}
227264
toSerialize["destination"] = o.Destination
228265
if o.IncludeTags != nil {
229266
toSerialize["include_tags"] = o.IncludeTags
@@ -246,12 +283,13 @@ func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) {
246283
// UnmarshalJSON deserializes the given payload.
247284
func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) {
248285
all := struct {
249-
Destination *LogsArchiveCreateRequestDestination `json:"destination"`
250-
IncludeTags *bool `json:"include_tags,omitempty"`
251-
Name *string `json:"name"`
252-
Query *string `json:"query"`
253-
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
254-
RehydrationTags []string `json:"rehydration_tags,omitempty"`
286+
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
287+
Destination *LogsArchiveCreateRequestDestination `json:"destination"`
288+
IncludeTags *bool `json:"include_tags,omitempty"`
289+
Name *string `json:"name"`
290+
Query *string `json:"query"`
291+
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
292+
RehydrationTags []string `json:"rehydration_tags,omitempty"`
255293
}{}
256294
if err = datadog.Unmarshal(bytes, &all); err != nil {
257295
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -267,10 +305,17 @@ func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err er
267305
}
268306
additionalProperties := make(map[string]interface{})
269307
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
270-
datadog.DeleteKeys(additionalProperties, &[]string{"destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags"})
308+
datadog.DeleteKeys(additionalProperties, &[]string{"compression_method", "destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags"})
271309
} else {
272310
return err
273311
}
312+
313+
hasInvalidField := false
314+
if all.CompressionMethod != nil && !all.CompressionMethod.IsValid() {
315+
hasInvalidField = true
316+
} else {
317+
o.CompressionMethod = all.CompressionMethod
318+
}
274319
o.Destination = *all.Destination
275320
o.IncludeTags = all.IncludeTags
276321
o.Name = *all.Name
@@ -282,5 +327,9 @@ func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err er
282327
o.AdditionalProperties = additionalProperties
283328
}
284329

330+
if hasInvalidField {
331+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
332+
}
333+
285334
return nil
286335
}

examples/v2/logs-archives/CreateLogsArchive.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func main() {
1616
body := datadogV2.LogsArchiveCreateRequest{
1717
Data: &datadogV2.LogsArchiveCreateRequestDefinition{
1818
Attributes: &datadogV2.LogsArchiveCreateRequestAttributes{
19+
CompressionMethod: datadogV2.LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP.Ptr(),
1920
Destination: datadogV2.LogsArchiveCreateRequestDestination{
2021
LogsArchiveDestinationAzure: &datadogV2.LogsArchiveDestinationAzure{
2122
Container: "container-name",

examples/v2/logs-archives/UpdateLogsArchive.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func main() {
1616
body := datadogV2.LogsArchiveCreateRequest{
1717
Data: &datadogV2.LogsArchiveCreateRequestDefinition{
1818
Attributes: &datadogV2.LogsArchiveCreateRequestAttributes{
19+
CompressionMethod: datadogV2.LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP.Ptr(),
1920
Destination: datadogV2.LogsArchiveCreateRequestDestination{
2021
LogsArchiveDestinationAzure: &datadogV2.LogsArchiveDestinationAzure{
2122
Container: "container-name",

0 commit comments

Comments
 (0)