Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41379,6 +41379,8 @@ components:
LogsArchiveAttributes:
description: The attributes associated with the archive.
properties:
compression_method:
$ref: "#/components/schemas/LogsArchiveAttributesCompressionMethod"
destination:
$ref: "#/components/schemas/LogsArchiveDestination"
include_tags:
Expand Down Expand Up @@ -41416,6 +41418,17 @@ components:
- query
- destination
type: object
LogsArchiveAttributesCompressionMethod:
default: GZIP
description: The type of compression for the archive.
enum:
- GZIP
- ZSTD
example: GZIP
type: string
x-enum-varnames:
- GZIP
- ZSTD
LogsArchiveCreateRequest:
description: The logs archive.
properties:
Expand All @@ -41425,6 +41438,8 @@ components:
LogsArchiveCreateRequestAttributes:
description: The attributes associated with the archive.
properties:
compression_method:
$ref: "#/components/schemas/LogsArchiveAttributesCompressionMethod"
destination:
$ref: "#/components/schemas/LogsArchiveCreateRequestDestination"
include_tags:
Expand Down Expand Up @@ -106036,6 +106051,7 @@ paths:
value:
data:
attributes:
compression_method: GZIP
destination:
container: container-name
storage_account: account-name
Expand Down Expand Up @@ -106175,6 +106191,7 @@ paths:
value:
data:
attributes:
compression_method: GZIP
destination:
container: container-name
storage_account: account-name
Expand Down
59 changes: 51 additions & 8 deletions api/datadogV2/model_logs_archive_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

// LogsArchiveAttributes The attributes associated with the archive.
type LogsArchiveAttributes struct {
// The type of compression for the archive.
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
// An archive's destination.
Destination NullableLogsArchiveDestination `json:"destination"`
// To store the tags in the archive, set the value "true".
Expand All @@ -38,6 +40,8 @@ type LogsArchiveAttributes struct {
// will change when the set of required properties is changed.
func NewLogsArchiveAttributes(destination NullableLogsArchiveDestination, name string, query string) *LogsArchiveAttributes {
this := LogsArchiveAttributes{}
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
this.CompressionMethod = &compressionMethod
this.Destination = destination
var includeTags bool = false
this.IncludeTags = &includeTags
Expand All @@ -51,11 +55,41 @@ func NewLogsArchiveAttributes(destination NullableLogsArchiveDestination, name s
// but it doesn't guarantee that properties required by API are set.
func NewLogsArchiveAttributesWithDefaults() *LogsArchiveAttributes {
this := LogsArchiveAttributes{}
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
this.CompressionMethod = &compressionMethod
var includeTags bool = false
this.IncludeTags = &includeTags
return &this
}

// GetCompressionMethod returns the CompressionMethod field value if set, zero value otherwise.
func (o *LogsArchiveAttributes) GetCompressionMethod() LogsArchiveAttributesCompressionMethod {
if o == nil || o.CompressionMethod == nil {
var ret LogsArchiveAttributesCompressionMethod
return ret
}
return *o.CompressionMethod
}

// GetCompressionMethodOk returns a tuple with the CompressionMethod field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsArchiveAttributes) GetCompressionMethodOk() (*LogsArchiveAttributesCompressionMethod, bool) {
if o == nil || o.CompressionMethod == nil {
return nil, false
}
return o.CompressionMethod, true
}

// HasCompressionMethod returns a boolean if a field has been set.
func (o *LogsArchiveAttributes) HasCompressionMethod() bool {
return o != nil && o.CompressionMethod != nil
}

// SetCompressionMethod gets a reference to the given LogsArchiveAttributesCompressionMethod and assigns it to the CompressionMethod field.
func (o *LogsArchiveAttributes) SetCompressionMethod(v LogsArchiveAttributesCompressionMethod) {
o.CompressionMethod = &v
}

// GetDestination returns the Destination field value.
// If the value is explicit nil, the zero value for LogsArchiveDestination will be returned.
func (o *LogsArchiveAttributes) GetDestination() LogsArchiveDestination {
Expand Down Expand Up @@ -256,6 +290,9 @@ func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.CompressionMethod != nil {
toSerialize["compression_method"] = o.CompressionMethod
}
toSerialize["destination"] = o.Destination.Get()
if o.IncludeTags != nil {
toSerialize["include_tags"] = o.IncludeTags
Expand All @@ -281,13 +318,14 @@ func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Destination NullableLogsArchiveDestination `json:"destination"`
IncludeTags *bool `json:"include_tags,omitempty"`
Name *string `json:"name"`
Query *string `json:"query"`
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
RehydrationTags []string `json:"rehydration_tags,omitempty"`
State *LogsArchiveState `json:"state,omitempty"`
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
Destination NullableLogsArchiveDestination `json:"destination"`
IncludeTags *bool `json:"include_tags,omitempty"`
Name *string `json:"name"`
Query *string `json:"query"`
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
RehydrationTags []string `json:"rehydration_tags,omitempty"`
State *LogsArchiveState `json:"state,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand All @@ -303,12 +341,17 @@ func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags", "state"})
datadog.DeleteKeys(additionalProperties, &[]string{"compression_method", "destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags", "state"})
} else {
return err
}

hasInvalidField := false
if all.CompressionMethod != nil && !all.CompressionMethod.IsValid() {
hasInvalidField = true
} else {
o.CompressionMethod = all.CompressionMethod
}
o.Destination = all.Destination
o.IncludeTags = all.IncludeTags
o.Name = *all.Name
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// LogsArchiveAttributesCompressionMethod The type of compression for the archive.
type LogsArchiveAttributesCompressionMethod string

// List of LogsArchiveAttributesCompressionMethod.
const (
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP LogsArchiveAttributesCompressionMethod = "GZIP"
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_ZSTD LogsArchiveAttributesCompressionMethod = "ZSTD"
)

var allowedLogsArchiveAttributesCompressionMethodEnumValues = []LogsArchiveAttributesCompressionMethod{
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP,
LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_ZSTD,
}

// GetAllowedValues reeturns the list of possible values.
func (v *LogsArchiveAttributesCompressionMethod) GetAllowedValues() []LogsArchiveAttributesCompressionMethod {
return allowedLogsArchiveAttributesCompressionMethodEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *LogsArchiveAttributesCompressionMethod) UnmarshalJSON(src []byte) error {
var value string
err := datadog.Unmarshal(src, &value)
if err != nil {
return err
}
*v = LogsArchiveAttributesCompressionMethod(value)
return nil
}

// NewLogsArchiveAttributesCompressionMethodFromValue returns a pointer to a valid LogsArchiveAttributesCompressionMethod
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewLogsArchiveAttributesCompressionMethodFromValue(v string) (*LogsArchiveAttributesCompressionMethod, error) {
ev := LogsArchiveAttributesCompressionMethod(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for LogsArchiveAttributesCompressionMethod: valid values are %v", v, allowedLogsArchiveAttributesCompressionMethodEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v LogsArchiveAttributesCompressionMethod) IsValid() bool {
for _, existing := range allowedLogsArchiveAttributesCompressionMethodEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to LogsArchiveAttributesCompressionMethod value.
func (v LogsArchiveAttributesCompressionMethod) Ptr() *LogsArchiveAttributesCompressionMethod {
return &v
}
63 changes: 56 additions & 7 deletions api/datadogV2/model_logs_archive_create_request_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

// LogsArchiveCreateRequestAttributes The attributes associated with the archive.
type LogsArchiveCreateRequestAttributes struct {
// The type of compression for the archive.
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
// An archive's destination.
Destination LogsArchiveCreateRequestDestination `json:"destination"`
// To store the tags in the archive, set the value "true".
Expand All @@ -36,6 +38,8 @@ type LogsArchiveCreateRequestAttributes struct {
// will change when the set of required properties is changed.
func NewLogsArchiveCreateRequestAttributes(destination LogsArchiveCreateRequestDestination, name string, query string) *LogsArchiveCreateRequestAttributes {
this := LogsArchiveCreateRequestAttributes{}
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
this.CompressionMethod = &compressionMethod
this.Destination = destination
var includeTags bool = false
this.IncludeTags = &includeTags
Expand All @@ -49,11 +53,41 @@ func NewLogsArchiveCreateRequestAttributes(destination LogsArchiveCreateRequestD
// but it doesn't guarantee that properties required by API are set.
func NewLogsArchiveCreateRequestAttributesWithDefaults() *LogsArchiveCreateRequestAttributes {
this := LogsArchiveCreateRequestAttributes{}
var compressionMethod LogsArchiveAttributesCompressionMethod = LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP
this.CompressionMethod = &compressionMethod
var includeTags bool = false
this.IncludeTags = &includeTags
return &this
}

// GetCompressionMethod returns the CompressionMethod field value if set, zero value otherwise.
func (o *LogsArchiveCreateRequestAttributes) GetCompressionMethod() LogsArchiveAttributesCompressionMethod {
if o == nil || o.CompressionMethod == nil {
var ret LogsArchiveAttributesCompressionMethod
return ret
}
return *o.CompressionMethod
}

// GetCompressionMethodOk returns a tuple with the CompressionMethod field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsArchiveCreateRequestAttributes) GetCompressionMethodOk() (*LogsArchiveAttributesCompressionMethod, bool) {
if o == nil || o.CompressionMethod == nil {
return nil, false
}
return o.CompressionMethod, true
}

// HasCompressionMethod returns a boolean if a field has been set.
func (o *LogsArchiveCreateRequestAttributes) HasCompressionMethod() bool {
return o != nil && o.CompressionMethod != nil
}

// SetCompressionMethod gets a reference to the given LogsArchiveAttributesCompressionMethod and assigns it to the CompressionMethod field.
func (o *LogsArchiveCreateRequestAttributes) SetCompressionMethod(v LogsArchiveAttributesCompressionMethod) {
o.CompressionMethod = &v
}

// GetDestination returns the Destination field value.
func (o *LogsArchiveCreateRequestAttributes) GetDestination() LogsArchiveCreateRequestDestination {
if o == nil {
Expand Down Expand Up @@ -224,6 +258,9 @@ func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.CompressionMethod != nil {
toSerialize["compression_method"] = o.CompressionMethod
}
toSerialize["destination"] = o.Destination
if o.IncludeTags != nil {
toSerialize["include_tags"] = o.IncludeTags
Expand All @@ -246,12 +283,13 @@ func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Destination *LogsArchiveCreateRequestDestination `json:"destination"`
IncludeTags *bool `json:"include_tags,omitempty"`
Name *string `json:"name"`
Query *string `json:"query"`
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
RehydrationTags []string `json:"rehydration_tags,omitempty"`
CompressionMethod *LogsArchiveAttributesCompressionMethod `json:"compression_method,omitempty"`
Destination *LogsArchiveCreateRequestDestination `json:"destination"`
IncludeTags *bool `json:"include_tags,omitempty"`
Name *string `json:"name"`
Query *string `json:"query"`
RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"`
RehydrationTags []string `json:"rehydration_tags,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand All @@ -267,10 +305,17 @@ func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err er
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags"})
datadog.DeleteKeys(additionalProperties, &[]string{"compression_method", "destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags"})
} else {
return err
}

hasInvalidField := false
if all.CompressionMethod != nil && !all.CompressionMethod.IsValid() {
hasInvalidField = true
} else {
o.CompressionMethod = all.CompressionMethod
}
o.Destination = *all.Destination
o.IncludeTags = all.IncludeTags
o.Name = *all.Name
Expand All @@ -282,5 +327,9 @@ func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err er
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
1 change: 1 addition & 0 deletions examples/v2/logs-archives/CreateLogsArchive.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func main() {
body := datadogV2.LogsArchiveCreateRequest{
Data: &datadogV2.LogsArchiveCreateRequestDefinition{
Attributes: &datadogV2.LogsArchiveCreateRequestAttributes{
CompressionMethod: datadogV2.LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP.Ptr(),
Destination: datadogV2.LogsArchiveCreateRequestDestination{
LogsArchiveDestinationAzure: &datadogV2.LogsArchiveDestinationAzure{
Container: "container-name",
Expand Down
1 change: 1 addition & 0 deletions examples/v2/logs-archives/UpdateLogsArchive.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func main() {
body := datadogV2.LogsArchiveCreateRequest{
Data: &datadogV2.LogsArchiveCreateRequestDefinition{
Attributes: &datadogV2.LogsArchiveCreateRequestAttributes{
CompressionMethod: datadogV2.LOGSARCHIVEATTRIBUTESCOMPRESSIONMETHOD_GZIP.Ptr(),
Destination: datadogV2.LogsArchiveCreateRequestDestination{
LogsArchiveDestinationAzure: &datadogV2.LogsArchiveDestinationAzure{
Container: "container-name",
Expand Down
Loading
Loading