From 3a67b4c2b346a24f048b353aa9b5ab83159dcd88 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 13:12:08 +0000 Subject: [PATCH 1/3] Update SearchFlakyTests endpoint documentation (#3929) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 155 ++++++- api/datadogV2/model_flaky_test_history.go | 91 +++- .../model_flaky_test_history_policy_id.go | 80 ++++ .../model_flaky_test_history_policy_meta.go | 387 +++++++++++++++++ ...l_flaky_test_history_policy_meta_config.go | 389 ++++++++++++++++++ .../model_flaky_tests_search_filter.go | 45 +- ...l_flaky_tests_search_request_attributes.go | 49 +-- .../v2/test-optimization/SearchFlakyTests.go | 4 +- .../SearchFlakyTests_1224086727.go | 4 +- .../SearchFlakyTests_209064879.go | 6 +- .../features/v2/test_optimization.feature | 10 +- 11 files changed, 1150 insertions(+), 70 deletions(-) create mode 100644 api/datadogV2/model_flaky_test_history_policy_id.go create mode 100644 api/datadogV2/model_flaky_test_history_policy_meta.go create mode 100644 api/datadogV2/model_flaky_test_history_policy_meta_config.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1d02f30912a..4841adf6836 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -26664,9 +26664,18 @@ components: Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available. example: - commit_sha: abc123def456 + policy_id: ftm_policy.quarantine.failure_rate + policy_meta: + config: + failure_rate: 0.1 + required_runs: 100 + failure_rate: 0.25 + total_runs: 200 status: quarantined timestamp: 1704067200000 - commit_sha: "" + policy_id: unknown + policy_meta: status: new timestamp: 1703980800000 items: @@ -26736,6 +26745,11 @@ components: description: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available. example: abc123def456 type: string + policy_id: + $ref: "#/components/schemas/FlakyTestHistoryPolicyId" + policy_meta: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMeta" + nullable: true status: description: The test status at this point in history. example: quarantined @@ -26750,6 +26764,131 @@ components: - commit_sha - timestamp type: object + FlakyTestHistoryPolicyId: + description: The policy that triggered this status change. + enum: + - ftm_policy.manual + - ftm_policy.fixed + - ftm_policy.disable.failure_rate + - ftm_policy.disable.branch_flake + - ftm_policy.disable.days_active + - ftm_policy.quarantine.failure_rate + - ftm_policy.quarantine.branch_flake + - ftm_policy.quarantine.days_active + - unknown + example: ftm_policy.quarantine.failure_rate + nullable: false + type: string + x-enum-varnames: + - MANUAL + - FIXED + - DISABLE_FAILURE_RATE + - DISABLE_BRANCH_FLAKE + - DISABLE_DAYS_ACTIVE + - QUARANTINE_FAILURE_RATE + - QUARANTINE_BRANCH_FLAKE + - QUARANTINE_DAYS_ACTIVE + - UNKNOWN + FlakyTestHistoryPolicyMeta: + description: Metadata about the policy that triggered this status change. + properties: + branches: + description: Branches where the test was flaky at the time of the status change. + example: ["main", "develop"] + items: + type: string + nullable: true + type: array + config: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMetaConfig" + nullable: true + days_active: + description: The number of days the test has been active at the time of the status change. + example: 15 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + days_without_flake: + description: The number of days since the test last exhibited flakiness. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate of the test at the time of the status change. + example: 0.25 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + state: + description: The previous state of the test. + example: quarantined + nullable: true + type: string + total_runs: + description: The total number of test runs at the time of the status change. + example: 200 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + type: object + FlakyTestHistoryPolicyMetaConfig: + description: Configuration parameters of the policy that triggered this status change. + properties: + branches: + description: The branches considered by the policy. + example: ["main"] + items: + type: string + nullable: true + type: array + days_active: + description: The number of days a test must have been active for the policy to trigger. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate threshold for the policy to trigger. + example: 0.7 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + forget_branches: + description: Branches excluded from the policy evaluation. + example: ["release"] + items: + type: string + nullable: true + type: array + required_runs: + description: The minimum number of test runs required for the policy to trigger. + example: 100 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + state: + description: The target state the policy transitions the test from. + example: quarantined + nullable: true + type: string + test_services: + description: Test services excluded from the policy evaluation. + example: ["my-service"] + items: + type: string + nullable: true + type: array + type: object FlakyTestPipelineStats: description: CI pipeline related statistics for the flaky test. This information is only available if test runs are associated with CI pipeline events from CI Visibility. properties: @@ -26829,6 +26968,14 @@ components: FlakyTestsSearchFilter: description: Search filter settings. properties: + include_history: + default: false + description: |- + Whether to include the status change history for each flaky test in the response. + When set to true, each test will include a `history` array with chronological status changes. + Defaults to false. + example: true + type: boolean query: default: "*" description: |- @@ -26874,14 +27021,6 @@ components: properties: filter: $ref: "#/components/schemas/FlakyTestsSearchFilter" - include_history: - default: false - description: |- - Whether to include the status change history for each flaky test in the response. - When set to true, each test will include a `history` array with chronological status changes. - Defaults to false. - example: true - type: boolean page: $ref: "#/components/schemas/FlakyTestsSearchPageOptions" sort: diff --git a/api/datadogV2/model_flaky_test_history.go b/api/datadogV2/model_flaky_test_history.go index 0df6ac508ec..f66d4c446ee 100644 --- a/api/datadogV2/model_flaky_test_history.go +++ b/api/datadogV2/model_flaky_test_history.go @@ -14,6 +14,10 @@ import ( type FlakyTestHistory struct { // The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available. CommitSha string `json:"commit_sha"` + // The policy that triggered this status change. + PolicyId *FlakyTestHistoryPolicyId `json:"policy_id,omitempty"` + // Metadata about the policy that triggered this status change. + PolicyMeta *FlakyTestHistoryPolicyMeta `json:"policy_meta,omitempty"` // The test status at this point in history. Status string `json:"status"` // Unix timestamp in milliseconds when this status change occurred. @@ -66,6 +70,62 @@ func (o *FlakyTestHistory) SetCommitSha(v string) { o.CommitSha = v } +// GetPolicyId returns the PolicyId field value if set, zero value otherwise. +func (o *FlakyTestHistory) GetPolicyId() FlakyTestHistoryPolicyId { + if o == nil || o.PolicyId == nil { + var ret FlakyTestHistoryPolicyId + return ret + } + return *o.PolicyId +} + +// GetPolicyIdOk returns a tuple with the PolicyId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FlakyTestHistory) GetPolicyIdOk() (*FlakyTestHistoryPolicyId, bool) { + if o == nil || o.PolicyId == nil { + return nil, false + } + return o.PolicyId, true +} + +// HasPolicyId returns a boolean if a field has been set. +func (o *FlakyTestHistory) HasPolicyId() bool { + return o != nil && o.PolicyId != nil +} + +// SetPolicyId gets a reference to the given FlakyTestHistoryPolicyId and assigns it to the PolicyId field. +func (o *FlakyTestHistory) SetPolicyId(v FlakyTestHistoryPolicyId) { + o.PolicyId = &v +} + +// GetPolicyMeta returns the PolicyMeta field value if set, zero value otherwise. +func (o *FlakyTestHistory) GetPolicyMeta() FlakyTestHistoryPolicyMeta { + if o == nil || o.PolicyMeta == nil { + var ret FlakyTestHistoryPolicyMeta + return ret + } + return *o.PolicyMeta +} + +// GetPolicyMetaOk returns a tuple with the PolicyMeta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FlakyTestHistory) GetPolicyMetaOk() (*FlakyTestHistoryPolicyMeta, bool) { + if o == nil || o.PolicyMeta == nil { + return nil, false + } + return o.PolicyMeta, true +} + +// HasPolicyMeta returns a boolean if a field has been set. +func (o *FlakyTestHistory) HasPolicyMeta() bool { + return o != nil && o.PolicyMeta != nil +} + +// SetPolicyMeta gets a reference to the given FlakyTestHistoryPolicyMeta and assigns it to the PolicyMeta field. +func (o *FlakyTestHistory) SetPolicyMeta(v FlakyTestHistoryPolicyMeta) { + o.PolicyMeta = &v +} + // GetStatus returns the Status field value. func (o *FlakyTestHistory) GetStatus() string { if o == nil { @@ -119,6 +179,12 @@ func (o FlakyTestHistory) MarshalJSON() ([]byte, error) { return datadog.Marshal(o.UnparsedObject) } toSerialize["commit_sha"] = o.CommitSha + if o.PolicyId != nil { + toSerialize["policy_id"] = o.PolicyId + } + if o.PolicyMeta != nil { + toSerialize["policy_meta"] = o.PolicyMeta + } toSerialize["status"] = o.Status toSerialize["timestamp"] = o.Timestamp @@ -131,9 +197,11 @@ func (o FlakyTestHistory) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FlakyTestHistory) UnmarshalJSON(bytes []byte) (err error) { all := struct { - CommitSha *string `json:"commit_sha"` - Status *string `json:"status"` - Timestamp *int64 `json:"timestamp"` + CommitSha *string `json:"commit_sha"` + PolicyId *FlakyTestHistoryPolicyId `json:"policy_id,omitempty"` + PolicyMeta *FlakyTestHistoryPolicyMeta `json:"policy_meta,omitempty"` + Status *string `json:"status"` + Timestamp *int64 `json:"timestamp"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -149,11 +217,22 @@ func (o *FlakyTestHistory) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"commit_sha", "status", "timestamp"}) + datadog.DeleteKeys(additionalProperties, &[]string{"commit_sha", "policy_id", "policy_meta", "status", "timestamp"}) } else { return err } + + hasInvalidField := false o.CommitSha = *all.CommitSha + if all.PolicyId != nil && !all.PolicyId.IsValid() { + hasInvalidField = true + } else { + o.PolicyId = all.PolicyId + } + if all.PolicyMeta != nil && all.PolicyMeta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.PolicyMeta = all.PolicyMeta o.Status = *all.Status o.Timestamp = *all.Timestamp @@ -161,5 +240,9 @@ func (o *FlakyTestHistory) UnmarshalJSON(bytes []byte) (err error) { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_flaky_test_history_policy_id.go b/api/datadogV2/model_flaky_test_history_policy_id.go new file mode 100644 index 00000000000..51006391268 --- /dev/null +++ b/api/datadogV2/model_flaky_test_history_policy_id.go @@ -0,0 +1,80 @@ +// 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" +) + +// FlakyTestHistoryPolicyId The policy that triggered this status change. +type FlakyTestHistoryPolicyId string + +// List of FlakyTestHistoryPolicyId. +const ( + FLAKYTESTHISTORYPOLICYID_MANUAL FlakyTestHistoryPolicyId = "ftm_policy.manual" + FLAKYTESTHISTORYPOLICYID_FIXED FlakyTestHistoryPolicyId = "ftm_policy.fixed" + FLAKYTESTHISTORYPOLICYID_DISABLE_FAILURE_RATE FlakyTestHistoryPolicyId = "ftm_policy.disable.failure_rate" + FLAKYTESTHISTORYPOLICYID_DISABLE_BRANCH_FLAKE FlakyTestHistoryPolicyId = "ftm_policy.disable.branch_flake" + FLAKYTESTHISTORYPOLICYID_DISABLE_DAYS_ACTIVE FlakyTestHistoryPolicyId = "ftm_policy.disable.days_active" + FLAKYTESTHISTORYPOLICYID_QUARANTINE_FAILURE_RATE FlakyTestHistoryPolicyId = "ftm_policy.quarantine.failure_rate" + FLAKYTESTHISTORYPOLICYID_QUARANTINE_BRANCH_FLAKE FlakyTestHistoryPolicyId = "ftm_policy.quarantine.branch_flake" + FLAKYTESTHISTORYPOLICYID_QUARANTINE_DAYS_ACTIVE FlakyTestHistoryPolicyId = "ftm_policy.quarantine.days_active" + FLAKYTESTHISTORYPOLICYID_UNKNOWN FlakyTestHistoryPolicyId = "unknown" +) + +var allowedFlakyTestHistoryPolicyIdEnumValues = []FlakyTestHistoryPolicyId{ + FLAKYTESTHISTORYPOLICYID_MANUAL, + FLAKYTESTHISTORYPOLICYID_FIXED, + FLAKYTESTHISTORYPOLICYID_DISABLE_FAILURE_RATE, + FLAKYTESTHISTORYPOLICYID_DISABLE_BRANCH_FLAKE, + FLAKYTESTHISTORYPOLICYID_DISABLE_DAYS_ACTIVE, + FLAKYTESTHISTORYPOLICYID_QUARANTINE_FAILURE_RATE, + FLAKYTESTHISTORYPOLICYID_QUARANTINE_BRANCH_FLAKE, + FLAKYTESTHISTORYPOLICYID_QUARANTINE_DAYS_ACTIVE, + FLAKYTESTHISTORYPOLICYID_UNKNOWN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FlakyTestHistoryPolicyId) GetAllowedValues() []FlakyTestHistoryPolicyId { + return allowedFlakyTestHistoryPolicyIdEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FlakyTestHistoryPolicyId) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FlakyTestHistoryPolicyId(value) + return nil +} + +// NewFlakyTestHistoryPolicyIdFromValue returns a pointer to a valid FlakyTestHistoryPolicyId +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFlakyTestHistoryPolicyIdFromValue(v string) (*FlakyTestHistoryPolicyId, error) { + ev := FlakyTestHistoryPolicyId(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FlakyTestHistoryPolicyId: valid values are %v", v, allowedFlakyTestHistoryPolicyIdEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FlakyTestHistoryPolicyId) IsValid() bool { + for _, existing := range allowedFlakyTestHistoryPolicyIdEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FlakyTestHistoryPolicyId value. +func (v FlakyTestHistoryPolicyId) Ptr() *FlakyTestHistoryPolicyId { + return &v +} diff --git a/api/datadogV2/model_flaky_test_history_policy_meta.go b/api/datadogV2/model_flaky_test_history_policy_meta.go new file mode 100644 index 00000000000..a4b07426bce --- /dev/null +++ b/api/datadogV2/model_flaky_test_history_policy_meta.go @@ -0,0 +1,387 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FlakyTestHistoryPolicyMeta Metadata about the policy that triggered this status change. +type FlakyTestHistoryPolicyMeta struct { + // Branches where the test was flaky at the time of the status change. + Branches datadog.NullableList[string] `json:"branches,omitempty"` + // Configuration parameters of the policy that triggered this status change. + Config *FlakyTestHistoryPolicyMetaConfig `json:"config,omitempty"` + // The number of days the test has been active at the time of the status change. + DaysActive datadog.NullableInt32 `json:"days_active,omitempty"` + // The number of days since the test last exhibited flakiness. + DaysWithoutFlake datadog.NullableInt32 `json:"days_without_flake,omitempty"` + // The failure rate of the test at the time of the status change. + FailureRate datadog.NullableFloat64 `json:"failure_rate,omitempty"` + // The previous state of the test. + State datadog.NullableString `json:"state,omitempty"` + // The total number of test runs at the time of the status change. + TotalRuns datadog.NullableInt32 `json:"total_runs,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFlakyTestHistoryPolicyMeta instantiates a new FlakyTestHistoryPolicyMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFlakyTestHistoryPolicyMeta() *FlakyTestHistoryPolicyMeta { + this := FlakyTestHistoryPolicyMeta{} + return &this +} + +// NewFlakyTestHistoryPolicyMetaWithDefaults instantiates a new FlakyTestHistoryPolicyMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFlakyTestHistoryPolicyMetaWithDefaults() *FlakyTestHistoryPolicyMeta { + this := FlakyTestHistoryPolicyMeta{} + return &this +} + +// GetBranches returns the Branches field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMeta) GetBranches() []string { + if o == nil || o.Branches.Get() == nil { + var ret []string + return ret + } + return *o.Branches.Get() +} + +// GetBranchesOk returns a tuple with the Branches field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMeta) GetBranchesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Branches.Get(), o.Branches.IsSet() +} + +// HasBranches returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMeta) HasBranches() bool { + return o != nil && o.Branches.IsSet() +} + +// SetBranches gets a reference to the given datadog.NullableList[string] and assigns it to the Branches field. +func (o *FlakyTestHistoryPolicyMeta) SetBranches(v []string) { + o.Branches.Set(&v) +} + +// SetBranchesNil sets the value for Branches to be an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) SetBranchesNil() { + o.Branches.Set(nil) +} + +// UnsetBranches ensures that no value is present for Branches, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) UnsetBranches() { + o.Branches.Unset() +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *FlakyTestHistoryPolicyMeta) GetConfig() FlakyTestHistoryPolicyMetaConfig { + if o == nil || o.Config == nil { + var ret FlakyTestHistoryPolicyMetaConfig + return ret + } + return *o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FlakyTestHistoryPolicyMeta) GetConfigOk() (*FlakyTestHistoryPolicyMetaConfig, bool) { + if o == nil || o.Config == nil { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMeta) HasConfig() bool { + return o != nil && o.Config != nil +} + +// SetConfig gets a reference to the given FlakyTestHistoryPolicyMetaConfig and assigns it to the Config field. +func (o *FlakyTestHistoryPolicyMeta) SetConfig(v FlakyTestHistoryPolicyMetaConfig) { + o.Config = &v +} + +// GetDaysActive returns the DaysActive field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMeta) GetDaysActive() int32 { + if o == nil || o.DaysActive.Get() == nil { + var ret int32 + return ret + } + return *o.DaysActive.Get() +} + +// GetDaysActiveOk returns a tuple with the DaysActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMeta) GetDaysActiveOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.DaysActive.Get(), o.DaysActive.IsSet() +} + +// HasDaysActive returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMeta) HasDaysActive() bool { + return o != nil && o.DaysActive.IsSet() +} + +// SetDaysActive gets a reference to the given datadog.NullableInt32 and assigns it to the DaysActive field. +func (o *FlakyTestHistoryPolicyMeta) SetDaysActive(v int32) { + o.DaysActive.Set(&v) +} + +// SetDaysActiveNil sets the value for DaysActive to be an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) SetDaysActiveNil() { + o.DaysActive.Set(nil) +} + +// UnsetDaysActive ensures that no value is present for DaysActive, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) UnsetDaysActive() { + o.DaysActive.Unset() +} + +// GetDaysWithoutFlake returns the DaysWithoutFlake field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMeta) GetDaysWithoutFlake() int32 { + if o == nil || o.DaysWithoutFlake.Get() == nil { + var ret int32 + return ret + } + return *o.DaysWithoutFlake.Get() +} + +// GetDaysWithoutFlakeOk returns a tuple with the DaysWithoutFlake field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMeta) GetDaysWithoutFlakeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.DaysWithoutFlake.Get(), o.DaysWithoutFlake.IsSet() +} + +// HasDaysWithoutFlake returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMeta) HasDaysWithoutFlake() bool { + return o != nil && o.DaysWithoutFlake.IsSet() +} + +// SetDaysWithoutFlake gets a reference to the given datadog.NullableInt32 and assigns it to the DaysWithoutFlake field. +func (o *FlakyTestHistoryPolicyMeta) SetDaysWithoutFlake(v int32) { + o.DaysWithoutFlake.Set(&v) +} + +// SetDaysWithoutFlakeNil sets the value for DaysWithoutFlake to be an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) SetDaysWithoutFlakeNil() { + o.DaysWithoutFlake.Set(nil) +} + +// UnsetDaysWithoutFlake ensures that no value is present for DaysWithoutFlake, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) UnsetDaysWithoutFlake() { + o.DaysWithoutFlake.Unset() +} + +// GetFailureRate returns the FailureRate field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMeta) GetFailureRate() float64 { + if o == nil || o.FailureRate.Get() == nil { + var ret float64 + return ret + } + return *o.FailureRate.Get() +} + +// GetFailureRateOk returns a tuple with the FailureRate field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMeta) GetFailureRateOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.FailureRate.Get(), o.FailureRate.IsSet() +} + +// HasFailureRate returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMeta) HasFailureRate() bool { + return o != nil && o.FailureRate.IsSet() +} + +// SetFailureRate gets a reference to the given datadog.NullableFloat64 and assigns it to the FailureRate field. +func (o *FlakyTestHistoryPolicyMeta) SetFailureRate(v float64) { + o.FailureRate.Set(&v) +} + +// SetFailureRateNil sets the value for FailureRate to be an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) SetFailureRateNil() { + o.FailureRate.Set(nil) +} + +// UnsetFailureRate ensures that no value is present for FailureRate, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) UnsetFailureRate() { + o.FailureRate.Unset() +} + +// GetState returns the State field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMeta) GetState() string { + if o == nil || o.State.Get() == nil { + var ret string + return ret + } + return *o.State.Get() +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMeta) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.State.Get(), o.State.IsSet() +} + +// HasState returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMeta) HasState() bool { + return o != nil && o.State.IsSet() +} + +// SetState gets a reference to the given datadog.NullableString and assigns it to the State field. +func (o *FlakyTestHistoryPolicyMeta) SetState(v string) { + o.State.Set(&v) +} + +// SetStateNil sets the value for State to be an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) SetStateNil() { + o.State.Set(nil) +} + +// UnsetState ensures that no value is present for State, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) UnsetState() { + o.State.Unset() +} + +// GetTotalRuns returns the TotalRuns field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMeta) GetTotalRuns() int32 { + if o == nil || o.TotalRuns.Get() == nil { + var ret int32 + return ret + } + return *o.TotalRuns.Get() +} + +// GetTotalRunsOk returns a tuple with the TotalRuns field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMeta) GetTotalRunsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.TotalRuns.Get(), o.TotalRuns.IsSet() +} + +// HasTotalRuns returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMeta) HasTotalRuns() bool { + return o != nil && o.TotalRuns.IsSet() +} + +// SetTotalRuns gets a reference to the given datadog.NullableInt32 and assigns it to the TotalRuns field. +func (o *FlakyTestHistoryPolicyMeta) SetTotalRuns(v int32) { + o.TotalRuns.Set(&v) +} + +// SetTotalRunsNil sets the value for TotalRuns to be an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) SetTotalRunsNil() { + o.TotalRuns.Set(nil) +} + +// UnsetTotalRuns ensures that no value is present for TotalRuns, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMeta) UnsetTotalRuns() { + o.TotalRuns.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o FlakyTestHistoryPolicyMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Branches.IsSet() { + toSerialize["branches"] = o.Branches.Get() + } + if o.Config != nil { + toSerialize["config"] = o.Config + } + if o.DaysActive.IsSet() { + toSerialize["days_active"] = o.DaysActive.Get() + } + if o.DaysWithoutFlake.IsSet() { + toSerialize["days_without_flake"] = o.DaysWithoutFlake.Get() + } + if o.FailureRate.IsSet() { + toSerialize["failure_rate"] = o.FailureRate.Get() + } + if o.State.IsSet() { + toSerialize["state"] = o.State.Get() + } + if o.TotalRuns.IsSet() { + toSerialize["total_runs"] = o.TotalRuns.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FlakyTestHistoryPolicyMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Branches datadog.NullableList[string] `json:"branches,omitempty"` + Config *FlakyTestHistoryPolicyMetaConfig `json:"config,omitempty"` + DaysActive datadog.NullableInt32 `json:"days_active,omitempty"` + DaysWithoutFlake datadog.NullableInt32 `json:"days_without_flake,omitempty"` + FailureRate datadog.NullableFloat64 `json:"failure_rate,omitempty"` + State datadog.NullableString `json:"state,omitempty"` + TotalRuns datadog.NullableInt32 `json:"total_runs,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"branches", "config", "days_active", "days_without_flake", "failure_rate", "state", "total_runs"}) + } else { + return err + } + + hasInvalidField := false + o.Branches = all.Branches + if all.Config != nil && all.Config.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Config = all.Config + o.DaysActive = all.DaysActive + o.DaysWithoutFlake = all.DaysWithoutFlake + o.FailureRate = all.FailureRate + o.State = all.State + o.TotalRuns = all.TotalRuns + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_flaky_test_history_policy_meta_config.go b/api/datadogV2/model_flaky_test_history_policy_meta_config.go new file mode 100644 index 00000000000..27d51745f59 --- /dev/null +++ b/api/datadogV2/model_flaky_test_history_policy_meta_config.go @@ -0,0 +1,389 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FlakyTestHistoryPolicyMetaConfig Configuration parameters of the policy that triggered this status change. +type FlakyTestHistoryPolicyMetaConfig struct { + // The branches considered by the policy. + Branches datadog.NullableList[string] `json:"branches,omitempty"` + // The number of days a test must have been active for the policy to trigger. + DaysActive datadog.NullableInt32 `json:"days_active,omitempty"` + // The failure rate threshold for the policy to trigger. + FailureRate datadog.NullableFloat64 `json:"failure_rate,omitempty"` + // Branches excluded from the policy evaluation. + ForgetBranches datadog.NullableList[string] `json:"forget_branches,omitempty"` + // The minimum number of test runs required for the policy to trigger. + RequiredRuns datadog.NullableInt32 `json:"required_runs,omitempty"` + // The target state the policy transitions the test from. + State datadog.NullableString `json:"state,omitempty"` + // Test services excluded from the policy evaluation. + TestServices datadog.NullableList[string] `json:"test_services,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFlakyTestHistoryPolicyMetaConfig instantiates a new FlakyTestHistoryPolicyMetaConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFlakyTestHistoryPolicyMetaConfig() *FlakyTestHistoryPolicyMetaConfig { + this := FlakyTestHistoryPolicyMetaConfig{} + return &this +} + +// NewFlakyTestHistoryPolicyMetaConfigWithDefaults instantiates a new FlakyTestHistoryPolicyMetaConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFlakyTestHistoryPolicyMetaConfigWithDefaults() *FlakyTestHistoryPolicyMetaConfig { + this := FlakyTestHistoryPolicyMetaConfig{} + return &this +} + +// GetBranches returns the Branches field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMetaConfig) GetBranches() []string { + if o == nil || o.Branches.Get() == nil { + var ret []string + return ret + } + return *o.Branches.Get() +} + +// GetBranchesOk returns a tuple with the Branches field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMetaConfig) GetBranchesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Branches.Get(), o.Branches.IsSet() +} + +// HasBranches returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMetaConfig) HasBranches() bool { + return o != nil && o.Branches.IsSet() +} + +// SetBranches gets a reference to the given datadog.NullableList[string] and assigns it to the Branches field. +func (o *FlakyTestHistoryPolicyMetaConfig) SetBranches(v []string) { + o.Branches.Set(&v) +} + +// SetBranchesNil sets the value for Branches to be an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) SetBranchesNil() { + o.Branches.Set(nil) +} + +// UnsetBranches ensures that no value is present for Branches, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) UnsetBranches() { + o.Branches.Unset() +} + +// GetDaysActive returns the DaysActive field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMetaConfig) GetDaysActive() int32 { + if o == nil || o.DaysActive.Get() == nil { + var ret int32 + return ret + } + return *o.DaysActive.Get() +} + +// GetDaysActiveOk returns a tuple with the DaysActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMetaConfig) GetDaysActiveOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.DaysActive.Get(), o.DaysActive.IsSet() +} + +// HasDaysActive returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMetaConfig) HasDaysActive() bool { + return o != nil && o.DaysActive.IsSet() +} + +// SetDaysActive gets a reference to the given datadog.NullableInt32 and assigns it to the DaysActive field. +func (o *FlakyTestHistoryPolicyMetaConfig) SetDaysActive(v int32) { + o.DaysActive.Set(&v) +} + +// SetDaysActiveNil sets the value for DaysActive to be an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) SetDaysActiveNil() { + o.DaysActive.Set(nil) +} + +// UnsetDaysActive ensures that no value is present for DaysActive, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) UnsetDaysActive() { + o.DaysActive.Unset() +} + +// GetFailureRate returns the FailureRate field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMetaConfig) GetFailureRate() float64 { + if o == nil || o.FailureRate.Get() == nil { + var ret float64 + return ret + } + return *o.FailureRate.Get() +} + +// GetFailureRateOk returns a tuple with the FailureRate field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMetaConfig) GetFailureRateOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.FailureRate.Get(), o.FailureRate.IsSet() +} + +// HasFailureRate returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMetaConfig) HasFailureRate() bool { + return o != nil && o.FailureRate.IsSet() +} + +// SetFailureRate gets a reference to the given datadog.NullableFloat64 and assigns it to the FailureRate field. +func (o *FlakyTestHistoryPolicyMetaConfig) SetFailureRate(v float64) { + o.FailureRate.Set(&v) +} + +// SetFailureRateNil sets the value for FailureRate to be an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) SetFailureRateNil() { + o.FailureRate.Set(nil) +} + +// UnsetFailureRate ensures that no value is present for FailureRate, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) UnsetFailureRate() { + o.FailureRate.Unset() +} + +// GetForgetBranches returns the ForgetBranches field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMetaConfig) GetForgetBranches() []string { + if o == nil || o.ForgetBranches.Get() == nil { + var ret []string + return ret + } + return *o.ForgetBranches.Get() +} + +// GetForgetBranchesOk returns a tuple with the ForgetBranches field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMetaConfig) GetForgetBranchesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.ForgetBranches.Get(), o.ForgetBranches.IsSet() +} + +// HasForgetBranches returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMetaConfig) HasForgetBranches() bool { + return o != nil && o.ForgetBranches.IsSet() +} + +// SetForgetBranches gets a reference to the given datadog.NullableList[string] and assigns it to the ForgetBranches field. +func (o *FlakyTestHistoryPolicyMetaConfig) SetForgetBranches(v []string) { + o.ForgetBranches.Set(&v) +} + +// SetForgetBranchesNil sets the value for ForgetBranches to be an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) SetForgetBranchesNil() { + o.ForgetBranches.Set(nil) +} + +// UnsetForgetBranches ensures that no value is present for ForgetBranches, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) UnsetForgetBranches() { + o.ForgetBranches.Unset() +} + +// GetRequiredRuns returns the RequiredRuns field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMetaConfig) GetRequiredRuns() int32 { + if o == nil || o.RequiredRuns.Get() == nil { + var ret int32 + return ret + } + return *o.RequiredRuns.Get() +} + +// GetRequiredRunsOk returns a tuple with the RequiredRuns field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMetaConfig) GetRequiredRunsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RequiredRuns.Get(), o.RequiredRuns.IsSet() +} + +// HasRequiredRuns returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMetaConfig) HasRequiredRuns() bool { + return o != nil && o.RequiredRuns.IsSet() +} + +// SetRequiredRuns gets a reference to the given datadog.NullableInt32 and assigns it to the RequiredRuns field. +func (o *FlakyTestHistoryPolicyMetaConfig) SetRequiredRuns(v int32) { + o.RequiredRuns.Set(&v) +} + +// SetRequiredRunsNil sets the value for RequiredRuns to be an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) SetRequiredRunsNil() { + o.RequiredRuns.Set(nil) +} + +// UnsetRequiredRuns ensures that no value is present for RequiredRuns, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) UnsetRequiredRuns() { + o.RequiredRuns.Unset() +} + +// GetState returns the State field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMetaConfig) GetState() string { + if o == nil || o.State.Get() == nil { + var ret string + return ret + } + return *o.State.Get() +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMetaConfig) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.State.Get(), o.State.IsSet() +} + +// HasState returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMetaConfig) HasState() bool { + return o != nil && o.State.IsSet() +} + +// SetState gets a reference to the given datadog.NullableString and assigns it to the State field. +func (o *FlakyTestHistoryPolicyMetaConfig) SetState(v string) { + o.State.Set(&v) +} + +// SetStateNil sets the value for State to be an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) SetStateNil() { + o.State.Set(nil) +} + +// UnsetState ensures that no value is present for State, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) UnsetState() { + o.State.Unset() +} + +// GetTestServices returns the TestServices field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FlakyTestHistoryPolicyMetaConfig) GetTestServices() []string { + if o == nil || o.TestServices.Get() == nil { + var ret []string + return ret + } + return *o.TestServices.Get() +} + +// GetTestServicesOk returns a tuple with the TestServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *FlakyTestHistoryPolicyMetaConfig) GetTestServicesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.TestServices.Get(), o.TestServices.IsSet() +} + +// HasTestServices returns a boolean if a field has been set. +func (o *FlakyTestHistoryPolicyMetaConfig) HasTestServices() bool { + return o != nil && o.TestServices.IsSet() +} + +// SetTestServices gets a reference to the given datadog.NullableList[string] and assigns it to the TestServices field. +func (o *FlakyTestHistoryPolicyMetaConfig) SetTestServices(v []string) { + o.TestServices.Set(&v) +} + +// SetTestServicesNil sets the value for TestServices to be an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) SetTestServicesNil() { + o.TestServices.Set(nil) +} + +// UnsetTestServices ensures that no value is present for TestServices, not even an explicit nil. +func (o *FlakyTestHistoryPolicyMetaConfig) UnsetTestServices() { + o.TestServices.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o FlakyTestHistoryPolicyMetaConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Branches.IsSet() { + toSerialize["branches"] = o.Branches.Get() + } + if o.DaysActive.IsSet() { + toSerialize["days_active"] = o.DaysActive.Get() + } + if o.FailureRate.IsSet() { + toSerialize["failure_rate"] = o.FailureRate.Get() + } + if o.ForgetBranches.IsSet() { + toSerialize["forget_branches"] = o.ForgetBranches.Get() + } + if o.RequiredRuns.IsSet() { + toSerialize["required_runs"] = o.RequiredRuns.Get() + } + if o.State.IsSet() { + toSerialize["state"] = o.State.Get() + } + if o.TestServices.IsSet() { + toSerialize["test_services"] = o.TestServices.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FlakyTestHistoryPolicyMetaConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Branches datadog.NullableList[string] `json:"branches,omitempty"` + DaysActive datadog.NullableInt32 `json:"days_active,omitempty"` + FailureRate datadog.NullableFloat64 `json:"failure_rate,omitempty"` + ForgetBranches datadog.NullableList[string] `json:"forget_branches,omitempty"` + RequiredRuns datadog.NullableInt32 `json:"required_runs,omitempty"` + State datadog.NullableString `json:"state,omitempty"` + TestServices datadog.NullableList[string] `json:"test_services,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"branches", "days_active", "failure_rate", "forget_branches", "required_runs", "state", "test_services"}) + } else { + return err + } + o.Branches = all.Branches + o.DaysActive = all.DaysActive + o.FailureRate = all.FailureRate + o.ForgetBranches = all.ForgetBranches + o.RequiredRuns = all.RequiredRuns + o.State = all.State + o.TestServices = all.TestServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_flaky_tests_search_filter.go b/api/datadogV2/model_flaky_tests_search_filter.go index 78f8b4ffba5..61ec4705342 100644 --- a/api/datadogV2/model_flaky_tests_search_filter.go +++ b/api/datadogV2/model_flaky_tests_search_filter.go @@ -10,6 +10,10 @@ import ( // FlakyTestsSearchFilter Search filter settings. type FlakyTestsSearchFilter struct { + // Whether to include the status change history for each flaky test in the response. + // When set to true, each test will include a `history` array with chronological status changes. + // Defaults to false. + IncludeHistory *bool `json:"include_history,omitempty"` // Search query following log syntax used to filter flaky tests, same as on Flaky Tests Management UI. The supported search keys are: // - `flaky_test_state` // - `flaky_test_category` @@ -33,6 +37,8 @@ type FlakyTestsSearchFilter struct { // will change when the set of required properties is changed. func NewFlakyTestsSearchFilter() *FlakyTestsSearchFilter { this := FlakyTestsSearchFilter{} + var includeHistory bool = false + this.IncludeHistory = &includeHistory var query string = "*" this.Query = &query return &this @@ -43,11 +49,41 @@ func NewFlakyTestsSearchFilter() *FlakyTestsSearchFilter { // but it doesn't guarantee that properties required by API are set. func NewFlakyTestsSearchFilterWithDefaults() *FlakyTestsSearchFilter { this := FlakyTestsSearchFilter{} + var includeHistory bool = false + this.IncludeHistory = &includeHistory var query string = "*" this.Query = &query return &this } +// GetIncludeHistory returns the IncludeHistory field value if set, zero value otherwise. +func (o *FlakyTestsSearchFilter) GetIncludeHistory() bool { + if o == nil || o.IncludeHistory == nil { + var ret bool + return ret + } + return *o.IncludeHistory +} + +// GetIncludeHistoryOk returns a tuple with the IncludeHistory field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FlakyTestsSearchFilter) GetIncludeHistoryOk() (*bool, bool) { + if o == nil || o.IncludeHistory == nil { + return nil, false + } + return o.IncludeHistory, true +} + +// HasIncludeHistory returns a boolean if a field has been set. +func (o *FlakyTestsSearchFilter) HasIncludeHistory() bool { + return o != nil && o.IncludeHistory != nil +} + +// SetIncludeHistory gets a reference to the given bool and assigns it to the IncludeHistory field. +func (o *FlakyTestsSearchFilter) SetIncludeHistory(v bool) { + o.IncludeHistory = &v +} + // GetQuery returns the Query field value if set, zero value otherwise. func (o *FlakyTestsSearchFilter) GetQuery() string { if o == nil || o.Query == nil { @@ -82,6 +118,9 @@ func (o FlakyTestsSearchFilter) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.IncludeHistory != nil { + toSerialize["include_history"] = o.IncludeHistory + } if o.Query != nil { toSerialize["query"] = o.Query } @@ -95,17 +134,19 @@ func (o FlakyTestsSearchFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FlakyTestsSearchFilter) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Query *string `json:"query,omitempty"` + IncludeHistory *bool `json:"include_history,omitempty"` + Query *string `json:"query,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"query"}) + datadog.DeleteKeys(additionalProperties, &[]string{"include_history", "query"}) } else { return err } + o.IncludeHistory = all.IncludeHistory o.Query = all.Query if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_flaky_tests_search_request_attributes.go b/api/datadogV2/model_flaky_tests_search_request_attributes.go index d0aba15013c..b27daba4a46 100644 --- a/api/datadogV2/model_flaky_tests_search_request_attributes.go +++ b/api/datadogV2/model_flaky_tests_search_request_attributes.go @@ -12,10 +12,6 @@ import ( type FlakyTestsSearchRequestAttributes struct { // Search filter settings. Filter *FlakyTestsSearchFilter `json:"filter,omitempty"` - // Whether to include the status change history for each flaky test in the response. - // When set to true, each test will include a `history` array with chronological status changes. - // Defaults to false. - IncludeHistory *bool `json:"include_history,omitempty"` // Pagination attributes for listing flaky tests. Page *FlakyTestsSearchPageOptions `json:"page,omitempty"` // Parameter for sorting flaky test results. The default sort is by ascending Fully Qualified Name (FQN). The FQN is the concatenation of the test module, suite, and name. @@ -31,8 +27,6 @@ type FlakyTestsSearchRequestAttributes struct { // will change when the set of required properties is changed. func NewFlakyTestsSearchRequestAttributes() *FlakyTestsSearchRequestAttributes { this := FlakyTestsSearchRequestAttributes{} - var includeHistory bool = false - this.IncludeHistory = &includeHistory return &this } @@ -41,8 +35,6 @@ func NewFlakyTestsSearchRequestAttributes() *FlakyTestsSearchRequestAttributes { // but it doesn't guarantee that properties required by API are set. func NewFlakyTestsSearchRequestAttributesWithDefaults() *FlakyTestsSearchRequestAttributes { this := FlakyTestsSearchRequestAttributes{} - var includeHistory bool = false - this.IncludeHistory = &includeHistory return &this } @@ -74,34 +66,6 @@ func (o *FlakyTestsSearchRequestAttributes) SetFilter(v FlakyTestsSearchFilter) o.Filter = &v } -// GetIncludeHistory returns the IncludeHistory field value if set, zero value otherwise. -func (o *FlakyTestsSearchRequestAttributes) GetIncludeHistory() bool { - if o == nil || o.IncludeHistory == nil { - var ret bool - return ret - } - return *o.IncludeHistory -} - -// GetIncludeHistoryOk returns a tuple with the IncludeHistory field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FlakyTestsSearchRequestAttributes) GetIncludeHistoryOk() (*bool, bool) { - if o == nil || o.IncludeHistory == nil { - return nil, false - } - return o.IncludeHistory, true -} - -// HasIncludeHistory returns a boolean if a field has been set. -func (o *FlakyTestsSearchRequestAttributes) HasIncludeHistory() bool { - return o != nil && o.IncludeHistory != nil -} - -// SetIncludeHistory gets a reference to the given bool and assigns it to the IncludeHistory field. -func (o *FlakyTestsSearchRequestAttributes) SetIncludeHistory(v bool) { - o.IncludeHistory = &v -} - // GetPage returns the Page field value if set, zero value otherwise. func (o *FlakyTestsSearchRequestAttributes) GetPage() FlakyTestsSearchPageOptions { if o == nil || o.Page == nil { @@ -167,9 +131,6 @@ func (o FlakyTestsSearchRequestAttributes) MarshalJSON() ([]byte, error) { if o.Filter != nil { toSerialize["filter"] = o.Filter } - if o.IncludeHistory != nil { - toSerialize["include_history"] = o.IncludeHistory - } if o.Page != nil { toSerialize["page"] = o.Page } @@ -186,17 +147,16 @@ func (o FlakyTestsSearchRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FlakyTestsSearchRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Filter *FlakyTestsSearchFilter `json:"filter,omitempty"` - IncludeHistory *bool `json:"include_history,omitempty"` - Page *FlakyTestsSearchPageOptions `json:"page,omitempty"` - Sort *FlakyTestsSearchSort `json:"sort,omitempty"` + Filter *FlakyTestsSearchFilter `json:"filter,omitempty"` + Page *FlakyTestsSearchPageOptions `json:"page,omitempty"` + Sort *FlakyTestsSearchSort `json:"sort,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"filter", "include_history", "page", "sort"}) + datadog.DeleteKeys(additionalProperties, &[]string{"filter", "page", "sort"}) } else { return err } @@ -206,7 +166,6 @@ func (o *FlakyTestsSearchRequestAttributes) UnmarshalJSON(bytes []byte) (err err hasInvalidField = true } o.Filter = all.Filter - o.IncludeHistory = all.IncludeHistory if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } diff --git a/examples/v2/test-optimization/SearchFlakyTests.go b/examples/v2/test-optimization/SearchFlakyTests.go index 02bc6c91f98..d69de540fca 100644 --- a/examples/v2/test-optimization/SearchFlakyTests.go +++ b/examples/v2/test-optimization/SearchFlakyTests.go @@ -17,9 +17,9 @@ func main() { Data: &datadogV2.FlakyTestsSearchRequestData{ Attributes: &datadogV2.FlakyTestsSearchRequestAttributes{ Filter: &datadogV2.FlakyTestsSearchFilter{ - Query: datadog.PtrString(`flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`), + IncludeHistory: datadog.PtrBool(true), + Query: datadog.PtrString(`flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`), }, - IncludeHistory: datadog.PtrBool(true), Page: &datadogV2.FlakyTestsSearchPageOptions{ Cursor: datadog.PtrString("eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="), Limit: datadog.PtrInt64(25), diff --git a/examples/v2/test-optimization/SearchFlakyTests_1224086727.go b/examples/v2/test-optimization/SearchFlakyTests_1224086727.go index 053808fd1bb..e557a487d3d 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_1224086727.go +++ b/examples/v2/test-optimization/SearchFlakyTests_1224086727.go @@ -17,9 +17,9 @@ func main() { Data: &datadogV2.FlakyTestsSearchRequestData{ Attributes: &datadogV2.FlakyTestsSearchRequestAttributes{ Filter: &datadogV2.FlakyTestsSearchFilter{ - Query: datadog.PtrString(`flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`), + IncludeHistory: datadog.PtrBool(true), + Query: datadog.PtrString(`flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`), }, - IncludeHistory: datadog.PtrBool(true), Page: &datadogV2.FlakyTestsSearchPageOptions{ Cursor: datadog.PtrString("eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="), Limit: datadog.PtrInt64(25), diff --git a/examples/v2/test-optimization/SearchFlakyTests_209064879.go b/examples/v2/test-optimization/SearchFlakyTests_209064879.go index 226f34ba41a..72a458f865e 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_209064879.go +++ b/examples/v2/test-optimization/SearchFlakyTests_209064879.go @@ -17,13 +17,13 @@ func main() { Data: &datadogV2.FlakyTestsSearchRequestData{ Attributes: &datadogV2.FlakyTestsSearchRequestAttributes{ Filter: &datadogV2.FlakyTestsSearchFilter{ - Query: datadog.PtrString(`flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`), + Query: datadog.PtrString(`flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`), + IncludeHistory: datadog.PtrBool(true), }, Page: &datadogV2.FlakyTestsSearchPageOptions{ Limit: datadog.PtrInt64(10), }, - Sort: datadogV2.FLAKYTESTSSEARCHSORT_FQN_ASCENDING.Ptr(), - IncludeHistory: datadog.PtrBool(true), + Sort: datadogV2.FLAKYTESTSSEARCHSORT_FQN_ASCENDING.Ptr(), }, Type: datadogV2.FLAKYTESTSSEARCHREQUESTDATATYPE_SEARCH_FLAKY_TESTS_REQUEST.Ptr(), }, diff --git a/tests/scenarios/features/v2/test_optimization.feature b/tests/scenarios/features/v2/test_optimization.feature index eeeec1dd340..8838a4998ee 100644 --- a/tests/scenarios/features/v2/test_optimization.feature +++ b/tests/scenarios/features/v2/test_optimization.feature @@ -117,7 +117,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "Bad Request" response Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 400 Bad Request @@ -133,7 +133,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "OK" response Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 200 OK @@ -149,19 +149,21 @@ Feature: Test Optimization Scenario: Search flaky tests returns "OK" response with history Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"limit": 10}, "sort": "fqn", "include_history": true}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\"", "include_history": true}, "page": {"limit": 10}, "sort": "fqn"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 200 OK And the response "data[0].attributes" has field "history" And the response "data[0].attributes.history[0]" has field "status" And the response "data[0].attributes.history[0]" has field "commit_sha" And the response "data[0].attributes.history[0]" has field "timestamp" + And the response "data[0].attributes.history[0]" has field "policy_id" + And the response "data[0].attributes.history[0]" has field "policy_meta" @generated @skip @team:DataDog/ci-app-backend @with-pagination Scenario: Search flaky tests returns "OK" response with pagination Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request with pagination is sent Then the response status is 200 OK From fb4b263afea393b0e9cf97834f04cb2ae36d2be8 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 14:22:00 +0000 Subject: [PATCH 2/3] Add domain prefix filter query parameter to list status pages API (#3960) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 5 +++++ api/datadogV2/api_status_pages.go | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4841adf6836..9481f1d6a5d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -115344,6 +115344,11 @@ paths: schema: default: 50 type: integer + - description: Filter status pages by exact domain prefix match. Returns at most one result. + in: query + name: filter[domain_prefix] + schema: + type: string - description: "Comma-separated list of resources to include. Supported values: created_by_user, last_modified_by_user." in: query name: include diff --git a/api/datadogV2/api_status_pages.go b/api/datadogV2/api_status_pages.go index 058aea2fdaa..7578d0d2464 100644 --- a/api/datadogV2/api_status_pages.go +++ b/api/datadogV2/api_status_pages.go @@ -1522,9 +1522,10 @@ func (a *StatusPagesApi) ListMaintenances(ctx _context.Context, o ...ListMainten // ListStatusPagesOptionalParameters holds optional parameters for ListStatusPages. type ListStatusPagesOptionalParameters struct { - PageOffset *int32 - PageLimit *int32 - Include *string + PageOffset *int32 + PageLimit *int32 + FilterDomainPrefix *string + Include *string } // NewListStatusPagesOptionalParameters creates an empty struct for parameters. @@ -1545,6 +1546,12 @@ func (r *ListStatusPagesOptionalParameters) WithPageLimit(pageLimit int32) *List return r } +// WithFilterDomainPrefix sets the corresponding parameter name and returns the struct. +func (r *ListStatusPagesOptionalParameters) WithFilterDomainPrefix(filterDomainPrefix string) *ListStatusPagesOptionalParameters { + r.FilterDomainPrefix = &filterDomainPrefix + return r +} + // WithInclude sets the corresponding parameter name and returns the struct. func (r *ListStatusPagesOptionalParameters) WithInclude(include string) *ListStatusPagesOptionalParameters { r.Include = &include @@ -1584,6 +1591,9 @@ func (a *StatusPagesApi) ListStatusPages(ctx _context.Context, o ...ListStatusPa if optionalParams.PageLimit != nil { localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, "")) } + if optionalParams.FilterDomainPrefix != nil { + localVarQueryParams.Add("filter[domain_prefix]", datadog.ParameterToString(*optionalParams.FilterDomainPrefix, "")) + } if optionalParams.Include != nil { localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) } From 326bc96e2d92c80bf7007a1b70100873277ba3fa Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 17:39:31 +0000 Subject: [PATCH 3/3] Add fleet tracers, clusters, and instrumented pods endpoints (#3947) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 616 ++++++++++++++++ api/datadog/configuration.go | 4 + api/datadogV2/api_fleet_automation.go | 567 +++++++++++++++ api/datadogV2/doc.go | 4 + .../model_fleet_cluster_attributes.go | 662 ++++++++++++++++++ .../model_fleet_clusters_response.go | 148 ++++ .../model_fleet_clusters_response_data.go | 174 +++++ ...fleet_clusters_response_data_attributes.go | 102 +++ .../model_fleet_clusters_response_meta.go | 102 +++ ...fleet_instrumented_pod_group_attributes.go | 417 +++++++++++ .../model_fleet_instrumented_pods_response.go | 110 +++ ...l_fleet_instrumented_pods_response_data.go | 174 +++++ ...trumented_pods_response_data_attributes.go | 102 +++ .../model_fleet_tracer_attributes.go | 417 +++++++++++ api/datadogV2/model_fleet_tracers_response.go | 148 ++++ .../model_fleet_tracers_response_data.go | 174 +++++ ..._fleet_tracers_response_data_attributes.go | 102 +++ .../model_fleet_tracers_response_meta.go | 102 +++ .../fleet-automation/ListFleetAgentTracers.go | 30 + .../v2/fleet-automation/ListFleetClusters.go | 30 + .../ListFleetInstrumentedPods.go | 30 + .../v2/fleet-automation/ListFleetTracers.go | 30 + .../features/v2/fleet_automation.feature | 90 +++ tests/scenarios/features/v2/undo.json | 24 + 24 files changed, 4359 insertions(+) create mode 100644 api/datadogV2/model_fleet_cluster_attributes.go create mode 100644 api/datadogV2/model_fleet_clusters_response.go create mode 100644 api/datadogV2/model_fleet_clusters_response_data.go create mode 100644 api/datadogV2/model_fleet_clusters_response_data_attributes.go create mode 100644 api/datadogV2/model_fleet_clusters_response_meta.go create mode 100644 api/datadogV2/model_fleet_instrumented_pod_group_attributes.go create mode 100644 api/datadogV2/model_fleet_instrumented_pods_response.go create mode 100644 api/datadogV2/model_fleet_instrumented_pods_response_data.go create mode 100644 api/datadogV2/model_fleet_instrumented_pods_response_data_attributes.go create mode 100644 api/datadogV2/model_fleet_tracer_attributes.go create mode 100644 api/datadogV2/model_fleet_tracers_response.go create mode 100644 api/datadogV2/model_fleet_tracers_response_data.go create mode 100644 api/datadogV2/model_fleet_tracers_response_data_attributes.go create mode 100644 api/datadogV2/model_fleet_tracers_response_meta.go create mode 100644 examples/v2/fleet-automation/ListFleetAgentTracers.go create mode 100644 examples/v2/fleet-automation/ListFleetClusters.go create mode 100644 examples/v2/fleet-automation/ListFleetInstrumentedPods.go create mode 100644 examples/v2/fleet-automation/ListFleetTracers.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9481f1d6a5d..75755ab7e79 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -27465,6 +27465,155 @@ components: format: int64 type: integer type: object + FleetClusterAttributes: + description: Attributes of a Kubernetes cluster in the fleet. + properties: + agent_versions: + description: Datadog Agent versions running in the cluster. + items: + description: A Datadog Agent version string. + type: string + type: array + api_key_names: + description: API key names used by agents in the cluster. + items: + description: An API key name. + type: string + type: array + api_key_uuids: + description: API key UUIDs used by agents in the cluster. + items: + description: An API key UUID. + type: string + type: array + cloud_providers: + description: Cloud providers hosting the cluster. + items: + description: A cloud provider name. + type: string + type: array + cluster_name: + description: The name of the Kubernetes cluster. + example: "production-us-east-1" + type: string + enabled_products: + description: Datadog products enabled in the cluster. + items: + description: A Datadog product name. + type: string + type: array + envs: + description: Environments associated with the cluster. + items: + description: An environment name. + type: string + type: array + first_seen_at: + description: Timestamp when the cluster was first seen. + format: int64 + type: integer + install_method_tool: + description: The tool used to install agents in the cluster. + example: "helm" + type: string + node_count: + description: Total number of nodes in the cluster. + example: 25 + format: int64 + type: integer + node_count_by_status: + $ref: "#/components/schemas/FleetClusterNodeCountByStatus" + operating_systems: + description: Operating systems of nodes in the cluster. + items: + description: An operating system name. + type: string + type: array + otel_collector_distributions: + description: OpenTelemetry collector distributions in the cluster. + items: + description: An OpenTelemetry collector distribution name. + type: string + type: array + otel_collector_versions: + description: OpenTelemetry collector versions in the cluster. + items: + description: An OpenTelemetry collector version string. + type: string + type: array + pod_count_by_state: + $ref: "#/components/schemas/FleetClusterPodCountByState" + services: + description: Services running in the cluster. + items: + description: A service name. + type: string + type: array + teams: + description: Teams associated with the cluster. + items: + description: A team name. + type: string + type: array + type: object + FleetClusterNodeCountByStatus: + additionalProperties: + format: int64 + type: integer + description: Node counts grouped by status. + type: object + FleetClusterPodCountByState: + additionalProperties: + format: int64 + type: integer + description: Pod counts grouped by state. + type: object + FleetClustersResponse: + description: Response containing a paginated list of fleet clusters. + properties: + data: + $ref: "#/components/schemas/FleetClustersResponseData" + meta: + $ref: "#/components/schemas/FleetClustersResponseMeta" + required: + - data + type: object + FleetClustersResponseData: + description: The response data containing status and clusters array. + properties: + attributes: + $ref: "#/components/schemas/FleetClustersResponseDataAttributes" + id: + description: Status identifier. + example: "done" + type: string + type: + description: Resource type. + example: "status" + type: string + required: + - id + - type + - attributes + type: object + FleetClustersResponseDataAttributes: + description: Attributes of the fleet clusters response containing the list of clusters. + properties: + clusters: + description: Array of clusters matching the query criteria. + items: + $ref: "#/components/schemas/FleetClusterAttributes" + type: array + type: object + FleetClustersResponseMeta: + description: Metadata for the list of clusters response. + properties: + total_filtered_count: + description: Total number of clusters matching the filter criteria across all pages. + example: 12 + format: int64 + type: integer + type: object FleetConfigurationFile: description: A configuration file for an integration. properties: @@ -27814,6 +27963,93 @@ components: example: "postgres" type: string type: object + FleetInstrumentedPodGroupAttributes: + description: Attributes of a group of instrumented pods targeted for SSI injection. + properties: + applied_target: + additionalProperties: {} + description: The SSI injection target configuration applied to the pod group. + type: object + applied_target_name: + description: The name of the applied SSI injection target. + example: "my-injection-target" + type: string + injected_tags: + description: Tags injected into the pods by the Admission Controller. + items: + description: An injected tag string. + type: string + type: array + kube_ownerref_kind: + description: The kind of the Kubernetes owner reference. + example: "Deployment" + type: string + kube_ownerref_name: + description: The name of the Kubernetes owner reference (deployment, statefulset, etc.). + example: "inventory-service" + type: string + lib_injection_annotations: + description: Library injection annotations on the pod group. + items: + description: A library injection annotation string. + type: string + type: array + namespace: + description: The Kubernetes namespace of the pod group. + example: "default" + type: string + pod_count: + description: Total number of pods in the group. + example: 3 + format: int64 + type: integer + pod_names: + description: Names of the individual pods in the group. + items: + description: A Kubernetes pod name. + type: string + type: array + tags: + additionalProperties: + type: string + description: Additional tags associated with the pod group. + type: object + type: object + FleetInstrumentedPodsResponse: + description: Response containing instrumented pods for a Kubernetes cluster. + properties: + data: + $ref: "#/components/schemas/FleetInstrumentedPodsResponseData" + required: + - data + type: object + FleetInstrumentedPodsResponseData: + description: The response data containing the cluster name and instrumented pod groups. + properties: + attributes: + $ref: "#/components/schemas/FleetInstrumentedPodsResponseDataAttributes" + id: + description: The cluster name identifier. + example: "production-us-east-1" + type: string + type: + description: Resource type. + example: "cluster_name" + type: string + required: + - id + - type + - attributes + type: object + FleetInstrumentedPodsResponseDataAttributes: + description: Attributes of the instrumented pods response containing the list of pod groups. + properties: + groups: + description: Array of instrumented pod groups in the cluster. + items: + $ref: "#/components/schemas/FleetInstrumentedPodGroupAttributes" + type: array + type: object FleetIntegrationDetails: description: Detailed information about a single integration. properties: @@ -28123,6 +28359,98 @@ components: required: - data type: object + FleetTracerAttributes: + description: Attributes of a fleet tracer representing a service instance reporting telemetry. + properties: + env: + description: The environment the tracer is reporting from. + example: "production" + type: string + hostname: + description: The hostname where the tracer is running. + example: "my-hostname" + type: string + language: + description: The programming language of the traced application. + example: "java" + type: string + language_version: + description: The version of the programming language runtime. + example: "17.0.1" + type: string + remote_config_status: + description: The remote configuration status of the tracer. + example: "connected" + type: string + runtime_ids: + description: Runtime identifiers for the tracer instances. + items: + description: A runtime identifier for a tracer instance. + type: string + type: array + service: + description: The telemetry-derived service name reported by the tracer. + example: "inventory-service" + type: string + service_hostname: + description: The service hostname reported by the tracer. + example: "my-service-host" + type: string + service_version: + description: The version of the traced service. + example: "2.1.0" + type: string + tracer_version: + description: The version of the Datadog tracer library. + example: "1.32.0" + type: string + type: object + FleetTracersResponse: + description: Response containing a paginated list of fleet tracers. + properties: + data: + $ref: "#/components/schemas/FleetTracersResponseData" + meta: + $ref: "#/components/schemas/FleetTracersResponseMeta" + required: + - data + type: object + FleetTracersResponseData: + description: The response data containing status and tracers array. + properties: + attributes: + $ref: "#/components/schemas/FleetTracersResponseDataAttributes" + id: + description: Status identifier. + example: "done" + type: string + type: + description: Resource type. + example: "status" + type: string + required: + - id + - type + - attributes + type: object + FleetTracersResponseDataAttributes: + description: Attributes of the fleet tracers response containing the list of tracers. + properties: + tracers: + description: Array of tracers matching the query criteria. + items: + $ref: "#/components/schemas/FleetTracerAttributes" + type: array + type: object + FleetTracersResponseMeta: + description: Metadata for the list of tracers response. + properties: + total_filtered_count: + description: Total number of tracers matching the filter criteria across all pages. + example: 42 + format: int64 + type: integer + type: object FormTrigger: description: "Trigger a workflow from a Form." properties: @@ -78309,6 +78637,214 @@ paths: x-unstable: |- This endpoint is in Preview and may introduce breaking changes. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/unstable/fleet/agents/{agent_key}/tracers: + get: + description: |- + Retrieve a paginated list of tracers for a specific agent. + + This endpoint returns tracers associated with a given agent key, identified by the + agent's hostname. Use this to discover telemetry-derived service names for a particular host. + operationId: ListFleetAgentTracers + parameters: + - description: The unique identifier (agent key) for the Datadog Agent. + in: path + name: agent_key + required: true + schema: + type: string + - description: Page number for pagination (starts at 0). + in: query + name: page_number + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + - description: Number of results per page (must be greater than 0 and less than or equal to 100). + in: query + name: page_size + required: false + schema: + default: 10 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: Attribute to sort by. + in: query + name: sort_attribute + required: false + schema: + type: string + - description: Sort order (true for descending, false for ascending). + in: query + name: sort_descending + required: false + schema: + default: true + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FleetTracersResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List tracers for a specific agent + tags: + - Fleet Automation + "x-permission": + operator: AND + permissions: + - hosts_read + x-unstable: |- + This endpoint is in Preview and may introduce breaking changes. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/unstable/fleet/clusters: + get: + description: |- + Retrieve a paginated list of Kubernetes clusters in the fleet. + + This endpoint returns clusters with metadata including node counts, agent versions, + enabled products, and associated services. Use the `page_number` and `page_size` + query parameters to paginate through results. + operationId: ListFleetClusters + parameters: + - description: Page number for pagination (starts at 0). + in: query + name: page_number + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + - description: Number of results per page (must be greater than 0 and less than or equal to 100). + in: query + name: page_size + required: false + schema: + default: 10 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: Attribute to sort by. + in: query + name: sort_attribute + required: false + schema: + type: string + - description: Sort order (true for descending, false for ascending). + in: query + name: sort_descending + required: false + schema: + type: boolean + - description: Filter string for narrowing down cluster results. + example: "cluster_name:production" + in: query + name: filter + required: false + schema: + type: string + - description: Comma-separated list of tags to filter clusters. + in: query + name: tags + required: false + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FleetClustersResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List all fleet clusters + tags: + - Fleet Automation + "x-permission": + operator: AND + permissions: + - hosts_read + x-unstable: |- + This endpoint is in Preview and may introduce breaking changes. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/unstable/fleet/clusters/{cluster_name}/instrumented_pods: + get: + description: |- + Retrieve the list of pods targeted for Single Step Instrumentation (SSI) injection + in a specific Kubernetes cluster. + + This endpoint returns pod groups organized by owner reference (deployment, statefulset, etc.) + with their injection annotations and applied targets. Use the clusters list endpoint + to discover available cluster names. + operationId: ListFleetInstrumentedPods + parameters: + - description: The name of the Kubernetes cluster. + in: path + name: cluster_name + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FleetInstrumentedPodsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List instrumented pods for a cluster + tags: + - Fleet Automation + "x-permission": + operator: AND + permissions: + - hosts_read + x-unstable: |- + This endpoint is in Preview and may introduce breaking changes. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/unstable/fleet/deployments: get: description: |- @@ -79101,6 +79637,86 @@ paths: x-unstable: |- This endpoint is in Preview and may introduce breaking changes. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/unstable/fleet/tracers: + get: + description: |- + Retrieve a paginated list of all fleet tracers. + + This endpoint returns telemetry-derived service names from the SDK telemetry pipeline. + These names may differ from span-derived names in APM and are useful for querying + service library configurations. + Use the `page_number` and `page_size` query parameters to paginate through results. + operationId: ListFleetTracers + parameters: + - description: Page number for pagination (starts at 0). + in: query + name: page_number + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + - description: Number of results per page (must be greater than 0 and less than or equal to 100). + in: query + name: page_size + required: false + schema: + default: 10 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: Attribute to sort by. + in: query + name: sort_attribute + required: false + schema: + type: string + - description: Sort order (true for descending, false for ascending). + in: query + name: sort_descending + required: false + schema: + default: true + type: boolean + - description: Filter string for narrowing down tracer results. + example: "hostname:my-host OR env:prod" + in: query + name: filter + required: false + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FleetTracersResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List all fleet tracers + tags: + - Fleet Automation + "x-permission": + operator: AND + permissions: + - hosts_read + x-unstable: |- + This endpoint is in Preview and may introduce breaking changes. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/actions-datastores: get: description: Lists all datastores for the organization. diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index f06a55624ca..d3c959f27a8 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -658,9 +658,13 @@ func NewConfiguration() *Configuration { "v2.GetFleetDeployment": false, "v2.GetFleetSchedule": false, "v2.ListFleetAgents": false, + "v2.ListFleetAgentTracers": false, "v2.ListFleetAgentVersions": false, + "v2.ListFleetClusters": false, "v2.ListFleetDeployments": false, + "v2.ListFleetInstrumentedPods": false, "v2.ListFleetSchedules": false, + "v2.ListFleetTracers": false, "v2.TriggerFleetSchedule": false, "v2.UpdateFleetSchedule": false, "v2.CreateOpenAPI": false, diff --git a/api/datadogV2/api_fleet_automation.go b/api/datadogV2/api_fleet_automation.go index 03abfb693ae..a54c3cf1a58 100644 --- a/api/datadogV2/api_fleet_automation.go +++ b/api/datadogV2/api_fleet_automation.go @@ -811,6 +811,154 @@ func (a *FleetAutomationApi) GetFleetSchedule(ctx _context.Context, id string) ( return localVarReturnValue, localVarHTTPResponse, nil } +// ListFleetAgentTracersOptionalParameters holds optional parameters for ListFleetAgentTracers. +type ListFleetAgentTracersOptionalParameters struct { + PageNumber *int64 + PageSize *int64 + SortAttribute *string + SortDescending *bool +} + +// NewListFleetAgentTracersOptionalParameters creates an empty struct for parameters. +func NewListFleetAgentTracersOptionalParameters() *ListFleetAgentTracersOptionalParameters { + this := ListFleetAgentTracersOptionalParameters{} + return &this +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListFleetAgentTracersOptionalParameters) WithPageNumber(pageNumber int64) *ListFleetAgentTracersOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListFleetAgentTracersOptionalParameters) WithPageSize(pageSize int64) *ListFleetAgentTracersOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithSortAttribute sets the corresponding parameter name and returns the struct. +func (r *ListFleetAgentTracersOptionalParameters) WithSortAttribute(sortAttribute string) *ListFleetAgentTracersOptionalParameters { + r.SortAttribute = &sortAttribute + return r +} + +// WithSortDescending sets the corresponding parameter name and returns the struct. +func (r *ListFleetAgentTracersOptionalParameters) WithSortDescending(sortDescending bool) *ListFleetAgentTracersOptionalParameters { + r.SortDescending = &sortDescending + return r +} + +// ListFleetAgentTracers List tracers for a specific agent. +// Retrieve a paginated list of tracers for a specific agent. +// +// This endpoint returns tracers associated with a given agent key, identified by the +// agent's hostname. Use this to discover telemetry-derived service names for a particular host. +func (a *FleetAutomationApi) ListFleetAgentTracers(ctx _context.Context, agentKey string, o ...ListFleetAgentTracersOptionalParameters) (FleetTracersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue FleetTracersResponse + optionalParams ListFleetAgentTracersOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListFleetAgentTracersOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListFleetAgentTracers" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.FleetAutomationApi.ListFleetAgentTracers") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/unstable/fleet/agents/{agent_key}/tracers" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{agent_key}", _neturl.PathEscape(datadog.ParameterToString(agentKey, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page_number", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page_size", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.SortAttribute != nil { + localVarQueryParams.Add("sort_attribute", datadog.ParameterToString(*optionalParams.SortAttribute, "")) + } + if optionalParams.SortDescending != nil { + localVarQueryParams.Add("sort_descending", datadog.ParameterToString(*optionalParams.SortDescending, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListFleetAgentVersions List all available Agent versions. // Retrieve a list of all available Datadog Agent versions. // @@ -1067,6 +1215,174 @@ func (a *FleetAutomationApi) ListFleetAgents(ctx _context.Context, o ...ListFlee return localVarReturnValue, localVarHTTPResponse, nil } +// ListFleetClustersOptionalParameters holds optional parameters for ListFleetClusters. +type ListFleetClustersOptionalParameters struct { + PageNumber *int64 + PageSize *int64 + SortAttribute *string + SortDescending *bool + Filter *string + Tags *string +} + +// NewListFleetClustersOptionalParameters creates an empty struct for parameters. +func NewListFleetClustersOptionalParameters() *ListFleetClustersOptionalParameters { + this := ListFleetClustersOptionalParameters{} + return &this +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListFleetClustersOptionalParameters) WithPageNumber(pageNumber int64) *ListFleetClustersOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListFleetClustersOptionalParameters) WithPageSize(pageSize int64) *ListFleetClustersOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithSortAttribute sets the corresponding parameter name and returns the struct. +func (r *ListFleetClustersOptionalParameters) WithSortAttribute(sortAttribute string) *ListFleetClustersOptionalParameters { + r.SortAttribute = &sortAttribute + return r +} + +// WithSortDescending sets the corresponding parameter name and returns the struct. +func (r *ListFleetClustersOptionalParameters) WithSortDescending(sortDescending bool) *ListFleetClustersOptionalParameters { + r.SortDescending = &sortDescending + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListFleetClustersOptionalParameters) WithFilter(filter string) *ListFleetClustersOptionalParameters { + r.Filter = &filter + return r +} + +// WithTags sets the corresponding parameter name and returns the struct. +func (r *ListFleetClustersOptionalParameters) WithTags(tags string) *ListFleetClustersOptionalParameters { + r.Tags = &tags + return r +} + +// ListFleetClusters List all fleet clusters. +// Retrieve a paginated list of Kubernetes clusters in the fleet. +// +// This endpoint returns clusters with metadata including node counts, agent versions, +// enabled products, and associated services. Use the `page_number` and `page_size` +// query parameters to paginate through results. +func (a *FleetAutomationApi) ListFleetClusters(ctx _context.Context, o ...ListFleetClustersOptionalParameters) (FleetClustersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue FleetClustersResponse + optionalParams ListFleetClustersOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListFleetClustersOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListFleetClusters" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.FleetAutomationApi.ListFleetClusters") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/unstable/fleet/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page_number", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page_size", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.SortAttribute != nil { + localVarQueryParams.Add("sort_attribute", datadog.ParameterToString(*optionalParams.SortAttribute, "")) + } + if optionalParams.SortDescending != nil { + localVarQueryParams.Add("sort_descending", datadog.ParameterToString(*optionalParams.SortDescending, "")) + } + if optionalParams.Filter != nil { + localVarQueryParams.Add("filter", datadog.ParameterToString(*optionalParams.Filter, "")) + } + if optionalParams.Tags != nil { + localVarQueryParams.Add("tags", datadog.ParameterToString(*optionalParams.Tags, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListFleetDeploymentsOptionalParameters holds optional parameters for ListFleetDeployments. type ListFleetDeploymentsOptionalParameters struct { PageSize *int64 @@ -1192,6 +1508,98 @@ func (a *FleetAutomationApi) ListFleetDeployments(ctx _context.Context, o ...Lis return localVarReturnValue, localVarHTTPResponse, nil } +// ListFleetInstrumentedPods List instrumented pods for a cluster. +// Retrieve the list of pods targeted for Single Step Instrumentation (SSI) injection +// in a specific Kubernetes cluster. +// +// This endpoint returns pod groups organized by owner reference (deployment, statefulset, etc.) +// with their injection annotations and applied targets. Use the clusters list endpoint +// to discover available cluster names. +func (a *FleetAutomationApi) ListFleetInstrumentedPods(ctx _context.Context, clusterName string) (FleetInstrumentedPodsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue FleetInstrumentedPodsResponse + ) + + operationId := "v2.ListFleetInstrumentedPods" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.FleetAutomationApi.ListFleetInstrumentedPods") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/unstable/fleet/clusters/{cluster_name}/instrumented_pods" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{cluster_name}", _neturl.PathEscape(datadog.ParameterToString(clusterName, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListFleetSchedules List all schedules. // Retrieve a list of all schedules for automated fleet deployments. // @@ -1282,6 +1690,165 @@ func (a *FleetAutomationApi) ListFleetSchedules(ctx _context.Context) (FleetSche return localVarReturnValue, localVarHTTPResponse, nil } +// ListFleetTracersOptionalParameters holds optional parameters for ListFleetTracers. +type ListFleetTracersOptionalParameters struct { + PageNumber *int64 + PageSize *int64 + SortAttribute *string + SortDescending *bool + Filter *string +} + +// NewListFleetTracersOptionalParameters creates an empty struct for parameters. +func NewListFleetTracersOptionalParameters() *ListFleetTracersOptionalParameters { + this := ListFleetTracersOptionalParameters{} + return &this +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListFleetTracersOptionalParameters) WithPageNumber(pageNumber int64) *ListFleetTracersOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListFleetTracersOptionalParameters) WithPageSize(pageSize int64) *ListFleetTracersOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithSortAttribute sets the corresponding parameter name and returns the struct. +func (r *ListFleetTracersOptionalParameters) WithSortAttribute(sortAttribute string) *ListFleetTracersOptionalParameters { + r.SortAttribute = &sortAttribute + return r +} + +// WithSortDescending sets the corresponding parameter name and returns the struct. +func (r *ListFleetTracersOptionalParameters) WithSortDescending(sortDescending bool) *ListFleetTracersOptionalParameters { + r.SortDescending = &sortDescending + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListFleetTracersOptionalParameters) WithFilter(filter string) *ListFleetTracersOptionalParameters { + r.Filter = &filter + return r +} + +// ListFleetTracers List all fleet tracers. +// Retrieve a paginated list of all fleet tracers. +// +// This endpoint returns telemetry-derived service names from the SDK telemetry pipeline. +// These names may differ from span-derived names in APM and are useful for querying +// service library configurations. +// Use the `page_number` and `page_size` query parameters to paginate through results. +func (a *FleetAutomationApi) ListFleetTracers(ctx _context.Context, o ...ListFleetTracersOptionalParameters) (FleetTracersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue FleetTracersResponse + optionalParams ListFleetTracersOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListFleetTracersOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListFleetTracers" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.FleetAutomationApi.ListFleetTracers") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/unstable/fleet/tracers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page_number", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page_size", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.SortAttribute != nil { + localVarQueryParams.Add("sort_attribute", datadog.ParameterToString(*optionalParams.SortAttribute, "")) + } + if optionalParams.SortDescending != nil { + localVarQueryParams.Add("sort_descending", datadog.ParameterToString(*optionalParams.SortDescending, "")) + } + if optionalParams.Filter != nil { + localVarQueryParams.Add("filter", datadog.ParameterToString(*optionalParams.Filter, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // TriggerFleetSchedule Trigger a schedule deployment. // Manually trigger a schedule to immediately create and start a deployment. // diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index c0ce13e88c0..2c519055e85 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -327,10 +327,14 @@ // - [FleetAutomationApi.GetFleetAgentInfo] // - [FleetAutomationApi.GetFleetDeployment] // - [FleetAutomationApi.GetFleetSchedule] +// - [FleetAutomationApi.ListFleetAgentTracers] // - [FleetAutomationApi.ListFleetAgentVersions] // - [FleetAutomationApi.ListFleetAgents] +// - [FleetAutomationApi.ListFleetClusters] // - [FleetAutomationApi.ListFleetDeployments] +// - [FleetAutomationApi.ListFleetInstrumentedPods] // - [FleetAutomationApi.ListFleetSchedules] +// - [FleetAutomationApi.ListFleetTracers] // - [FleetAutomationApi.TriggerFleetSchedule] // - [FleetAutomationApi.UpdateFleetSchedule] // - [GCPIntegrationApi.CreateGCPSTSAccount] diff --git a/api/datadogV2/model_fleet_cluster_attributes.go b/api/datadogV2/model_fleet_cluster_attributes.go new file mode 100644 index 00000000000..48b4d420245 --- /dev/null +++ b/api/datadogV2/model_fleet_cluster_attributes.go @@ -0,0 +1,662 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetClusterAttributes Attributes of a Kubernetes cluster in the fleet. +type FleetClusterAttributes struct { + // Datadog Agent versions running in the cluster. + AgentVersions []string `json:"agent_versions,omitempty"` + // API key names used by agents in the cluster. + ApiKeyNames []string `json:"api_key_names,omitempty"` + // API key UUIDs used by agents in the cluster. + ApiKeyUuids []string `json:"api_key_uuids,omitempty"` + // Cloud providers hosting the cluster. + CloudProviders []string `json:"cloud_providers,omitempty"` + // The name of the Kubernetes cluster. + ClusterName *string `json:"cluster_name,omitempty"` + // Datadog products enabled in the cluster. + EnabledProducts []string `json:"enabled_products,omitempty"` + // Environments associated with the cluster. + Envs []string `json:"envs,omitempty"` + // Timestamp when the cluster was first seen. + FirstSeenAt *int64 `json:"first_seen_at,omitempty"` + // The tool used to install agents in the cluster. + InstallMethodTool *string `json:"install_method_tool,omitempty"` + // Total number of nodes in the cluster. + NodeCount *int64 `json:"node_count,omitempty"` + // Node counts grouped by status. + NodeCountByStatus map[string]int64 `json:"node_count_by_status,omitempty"` + // Operating systems of nodes in the cluster. + OperatingSystems []string `json:"operating_systems,omitempty"` + // OpenTelemetry collector distributions in the cluster. + OtelCollectorDistributions []string `json:"otel_collector_distributions,omitempty"` + // OpenTelemetry collector versions in the cluster. + OtelCollectorVersions []string `json:"otel_collector_versions,omitempty"` + // Pod counts grouped by state. + PodCountByState map[string]int64 `json:"pod_count_by_state,omitempty"` + // Services running in the cluster. + Services []string `json:"services,omitempty"` + // Teams associated with the cluster. + Teams []string `json:"teams,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetClusterAttributes instantiates a new FleetClusterAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetClusterAttributes() *FleetClusterAttributes { + this := FleetClusterAttributes{} + return &this +} + +// NewFleetClusterAttributesWithDefaults instantiates a new FleetClusterAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetClusterAttributesWithDefaults() *FleetClusterAttributes { + this := FleetClusterAttributes{} + return &this +} + +// GetAgentVersions returns the AgentVersions field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetAgentVersions() []string { + if o == nil || o.AgentVersions == nil { + var ret []string + return ret + } + return o.AgentVersions +} + +// GetAgentVersionsOk returns a tuple with the AgentVersions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetAgentVersionsOk() (*[]string, bool) { + if o == nil || o.AgentVersions == nil { + return nil, false + } + return &o.AgentVersions, true +} + +// HasAgentVersions returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasAgentVersions() bool { + return o != nil && o.AgentVersions != nil +} + +// SetAgentVersions gets a reference to the given []string and assigns it to the AgentVersions field. +func (o *FleetClusterAttributes) SetAgentVersions(v []string) { + o.AgentVersions = v +} + +// GetApiKeyNames returns the ApiKeyNames field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetApiKeyNames() []string { + if o == nil || o.ApiKeyNames == nil { + var ret []string + return ret + } + return o.ApiKeyNames +} + +// GetApiKeyNamesOk returns a tuple with the ApiKeyNames field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetApiKeyNamesOk() (*[]string, bool) { + if o == nil || o.ApiKeyNames == nil { + return nil, false + } + return &o.ApiKeyNames, true +} + +// HasApiKeyNames returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasApiKeyNames() bool { + return o != nil && o.ApiKeyNames != nil +} + +// SetApiKeyNames gets a reference to the given []string and assigns it to the ApiKeyNames field. +func (o *FleetClusterAttributes) SetApiKeyNames(v []string) { + o.ApiKeyNames = v +} + +// GetApiKeyUuids returns the ApiKeyUuids field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetApiKeyUuids() []string { + if o == nil || o.ApiKeyUuids == nil { + var ret []string + return ret + } + return o.ApiKeyUuids +} + +// GetApiKeyUuidsOk returns a tuple with the ApiKeyUuids field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetApiKeyUuidsOk() (*[]string, bool) { + if o == nil || o.ApiKeyUuids == nil { + return nil, false + } + return &o.ApiKeyUuids, true +} + +// HasApiKeyUuids returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasApiKeyUuids() bool { + return o != nil && o.ApiKeyUuids != nil +} + +// SetApiKeyUuids gets a reference to the given []string and assigns it to the ApiKeyUuids field. +func (o *FleetClusterAttributes) SetApiKeyUuids(v []string) { + o.ApiKeyUuids = v +} + +// GetCloudProviders returns the CloudProviders field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetCloudProviders() []string { + if o == nil || o.CloudProviders == nil { + var ret []string + return ret + } + return o.CloudProviders +} + +// GetCloudProvidersOk returns a tuple with the CloudProviders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetCloudProvidersOk() (*[]string, bool) { + if o == nil || o.CloudProviders == nil { + return nil, false + } + return &o.CloudProviders, true +} + +// HasCloudProviders returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasCloudProviders() bool { + return o != nil && o.CloudProviders != nil +} + +// SetCloudProviders gets a reference to the given []string and assigns it to the CloudProviders field. +func (o *FleetClusterAttributes) SetCloudProviders(v []string) { + o.CloudProviders = v +} + +// GetClusterName returns the ClusterName field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetClusterName() string { + if o == nil || o.ClusterName == nil { + var ret string + return ret + } + return *o.ClusterName +} + +// GetClusterNameOk returns a tuple with the ClusterName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetClusterNameOk() (*string, bool) { + if o == nil || o.ClusterName == nil { + return nil, false + } + return o.ClusterName, true +} + +// HasClusterName returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasClusterName() bool { + return o != nil && o.ClusterName != nil +} + +// SetClusterName gets a reference to the given string and assigns it to the ClusterName field. +func (o *FleetClusterAttributes) SetClusterName(v string) { + o.ClusterName = &v +} + +// GetEnabledProducts returns the EnabledProducts field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetEnabledProducts() []string { + if o == nil || o.EnabledProducts == nil { + var ret []string + return ret + } + return o.EnabledProducts +} + +// GetEnabledProductsOk returns a tuple with the EnabledProducts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetEnabledProductsOk() (*[]string, bool) { + if o == nil || o.EnabledProducts == nil { + return nil, false + } + return &o.EnabledProducts, true +} + +// HasEnabledProducts returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasEnabledProducts() bool { + return o != nil && o.EnabledProducts != nil +} + +// SetEnabledProducts gets a reference to the given []string and assigns it to the EnabledProducts field. +func (o *FleetClusterAttributes) SetEnabledProducts(v []string) { + o.EnabledProducts = v +} + +// GetEnvs returns the Envs field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetEnvs() []string { + if o == nil || o.Envs == nil { + var ret []string + return ret + } + return o.Envs +} + +// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetEnvsOk() (*[]string, bool) { + if o == nil || o.Envs == nil { + return nil, false + } + return &o.Envs, true +} + +// HasEnvs returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasEnvs() bool { + return o != nil && o.Envs != nil +} + +// SetEnvs gets a reference to the given []string and assigns it to the Envs field. +func (o *FleetClusterAttributes) SetEnvs(v []string) { + o.Envs = v +} + +// GetFirstSeenAt returns the FirstSeenAt field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetFirstSeenAt() int64 { + if o == nil || o.FirstSeenAt == nil { + var ret int64 + return ret + } + return *o.FirstSeenAt +} + +// GetFirstSeenAtOk returns a tuple with the FirstSeenAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetFirstSeenAtOk() (*int64, bool) { + if o == nil || o.FirstSeenAt == nil { + return nil, false + } + return o.FirstSeenAt, true +} + +// HasFirstSeenAt returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasFirstSeenAt() bool { + return o != nil && o.FirstSeenAt != nil +} + +// SetFirstSeenAt gets a reference to the given int64 and assigns it to the FirstSeenAt field. +func (o *FleetClusterAttributes) SetFirstSeenAt(v int64) { + o.FirstSeenAt = &v +} + +// GetInstallMethodTool returns the InstallMethodTool field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetInstallMethodTool() string { + if o == nil || o.InstallMethodTool == nil { + var ret string + return ret + } + return *o.InstallMethodTool +} + +// GetInstallMethodToolOk returns a tuple with the InstallMethodTool field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetInstallMethodToolOk() (*string, bool) { + if o == nil || o.InstallMethodTool == nil { + return nil, false + } + return o.InstallMethodTool, true +} + +// HasInstallMethodTool returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasInstallMethodTool() bool { + return o != nil && o.InstallMethodTool != nil +} + +// SetInstallMethodTool gets a reference to the given string and assigns it to the InstallMethodTool field. +func (o *FleetClusterAttributes) SetInstallMethodTool(v string) { + o.InstallMethodTool = &v +} + +// GetNodeCount returns the NodeCount field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetNodeCount() int64 { + if o == nil || o.NodeCount == nil { + var ret int64 + return ret + } + return *o.NodeCount +} + +// GetNodeCountOk returns a tuple with the NodeCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetNodeCountOk() (*int64, bool) { + if o == nil || o.NodeCount == nil { + return nil, false + } + return o.NodeCount, true +} + +// HasNodeCount returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasNodeCount() bool { + return o != nil && o.NodeCount != nil +} + +// SetNodeCount gets a reference to the given int64 and assigns it to the NodeCount field. +func (o *FleetClusterAttributes) SetNodeCount(v int64) { + o.NodeCount = &v +} + +// GetNodeCountByStatus returns the NodeCountByStatus field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetNodeCountByStatus() map[string]int64 { + if o == nil || o.NodeCountByStatus == nil { + var ret map[string]int64 + return ret + } + return o.NodeCountByStatus +} + +// GetNodeCountByStatusOk returns a tuple with the NodeCountByStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetNodeCountByStatusOk() (*map[string]int64, bool) { + if o == nil || o.NodeCountByStatus == nil { + return nil, false + } + return &o.NodeCountByStatus, true +} + +// HasNodeCountByStatus returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasNodeCountByStatus() bool { + return o != nil && o.NodeCountByStatus != nil +} + +// SetNodeCountByStatus gets a reference to the given map[string]int64 and assigns it to the NodeCountByStatus field. +func (o *FleetClusterAttributes) SetNodeCountByStatus(v map[string]int64) { + o.NodeCountByStatus = v +} + +// GetOperatingSystems returns the OperatingSystems field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetOperatingSystems() []string { + if o == nil || o.OperatingSystems == nil { + var ret []string + return ret + } + return o.OperatingSystems +} + +// GetOperatingSystemsOk returns a tuple with the OperatingSystems field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetOperatingSystemsOk() (*[]string, bool) { + if o == nil || o.OperatingSystems == nil { + return nil, false + } + return &o.OperatingSystems, true +} + +// HasOperatingSystems returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasOperatingSystems() bool { + return o != nil && o.OperatingSystems != nil +} + +// SetOperatingSystems gets a reference to the given []string and assigns it to the OperatingSystems field. +func (o *FleetClusterAttributes) SetOperatingSystems(v []string) { + o.OperatingSystems = v +} + +// GetOtelCollectorDistributions returns the OtelCollectorDistributions field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetOtelCollectorDistributions() []string { + if o == nil || o.OtelCollectorDistributions == nil { + var ret []string + return ret + } + return o.OtelCollectorDistributions +} + +// GetOtelCollectorDistributionsOk returns a tuple with the OtelCollectorDistributions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetOtelCollectorDistributionsOk() (*[]string, bool) { + if o == nil || o.OtelCollectorDistributions == nil { + return nil, false + } + return &o.OtelCollectorDistributions, true +} + +// HasOtelCollectorDistributions returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasOtelCollectorDistributions() bool { + return o != nil && o.OtelCollectorDistributions != nil +} + +// SetOtelCollectorDistributions gets a reference to the given []string and assigns it to the OtelCollectorDistributions field. +func (o *FleetClusterAttributes) SetOtelCollectorDistributions(v []string) { + o.OtelCollectorDistributions = v +} + +// GetOtelCollectorVersions returns the OtelCollectorVersions field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetOtelCollectorVersions() []string { + if o == nil || o.OtelCollectorVersions == nil { + var ret []string + return ret + } + return o.OtelCollectorVersions +} + +// GetOtelCollectorVersionsOk returns a tuple with the OtelCollectorVersions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetOtelCollectorVersionsOk() (*[]string, bool) { + if o == nil || o.OtelCollectorVersions == nil { + return nil, false + } + return &o.OtelCollectorVersions, true +} + +// HasOtelCollectorVersions returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasOtelCollectorVersions() bool { + return o != nil && o.OtelCollectorVersions != nil +} + +// SetOtelCollectorVersions gets a reference to the given []string and assigns it to the OtelCollectorVersions field. +func (o *FleetClusterAttributes) SetOtelCollectorVersions(v []string) { + o.OtelCollectorVersions = v +} + +// GetPodCountByState returns the PodCountByState field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetPodCountByState() map[string]int64 { + if o == nil || o.PodCountByState == nil { + var ret map[string]int64 + return ret + } + return o.PodCountByState +} + +// GetPodCountByStateOk returns a tuple with the PodCountByState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetPodCountByStateOk() (*map[string]int64, bool) { + if o == nil || o.PodCountByState == nil { + return nil, false + } + return &o.PodCountByState, true +} + +// HasPodCountByState returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasPodCountByState() bool { + return o != nil && o.PodCountByState != nil +} + +// SetPodCountByState gets a reference to the given map[string]int64 and assigns it to the PodCountByState field. +func (o *FleetClusterAttributes) SetPodCountByState(v map[string]int64) { + o.PodCountByState = v +} + +// GetServices returns the Services field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetServices() []string { + if o == nil || o.Services == nil { + var ret []string + return ret + } + return o.Services +} + +// GetServicesOk returns a tuple with the Services field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetServicesOk() (*[]string, bool) { + if o == nil || o.Services == nil { + return nil, false + } + return &o.Services, true +} + +// HasServices returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasServices() bool { + return o != nil && o.Services != nil +} + +// SetServices gets a reference to the given []string and assigns it to the Services field. +func (o *FleetClusterAttributes) SetServices(v []string) { + o.Services = v +} + +// GetTeams returns the Teams field value if set, zero value otherwise. +func (o *FleetClusterAttributes) GetTeams() []string { + if o == nil || o.Teams == nil { + var ret []string + return ret + } + return o.Teams +} + +// GetTeamsOk returns a tuple with the Teams field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClusterAttributes) GetTeamsOk() (*[]string, bool) { + if o == nil || o.Teams == nil { + return nil, false + } + return &o.Teams, true +} + +// HasTeams returns a boolean if a field has been set. +func (o *FleetClusterAttributes) HasTeams() bool { + return o != nil && o.Teams != nil +} + +// SetTeams gets a reference to the given []string and assigns it to the Teams field. +func (o *FleetClusterAttributes) SetTeams(v []string) { + o.Teams = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetClusterAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AgentVersions != nil { + toSerialize["agent_versions"] = o.AgentVersions + } + if o.ApiKeyNames != nil { + toSerialize["api_key_names"] = o.ApiKeyNames + } + if o.ApiKeyUuids != nil { + toSerialize["api_key_uuids"] = o.ApiKeyUuids + } + if o.CloudProviders != nil { + toSerialize["cloud_providers"] = o.CloudProviders + } + if o.ClusterName != nil { + toSerialize["cluster_name"] = o.ClusterName + } + if o.EnabledProducts != nil { + toSerialize["enabled_products"] = o.EnabledProducts + } + if o.Envs != nil { + toSerialize["envs"] = o.Envs + } + if o.FirstSeenAt != nil { + toSerialize["first_seen_at"] = o.FirstSeenAt + } + if o.InstallMethodTool != nil { + toSerialize["install_method_tool"] = o.InstallMethodTool + } + if o.NodeCount != nil { + toSerialize["node_count"] = o.NodeCount + } + if o.NodeCountByStatus != nil { + toSerialize["node_count_by_status"] = o.NodeCountByStatus + } + if o.OperatingSystems != nil { + toSerialize["operating_systems"] = o.OperatingSystems + } + if o.OtelCollectorDistributions != nil { + toSerialize["otel_collector_distributions"] = o.OtelCollectorDistributions + } + if o.OtelCollectorVersions != nil { + toSerialize["otel_collector_versions"] = o.OtelCollectorVersions + } + if o.PodCountByState != nil { + toSerialize["pod_count_by_state"] = o.PodCountByState + } + if o.Services != nil { + toSerialize["services"] = o.Services + } + if o.Teams != nil { + toSerialize["teams"] = o.Teams + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetClusterAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AgentVersions []string `json:"agent_versions,omitempty"` + ApiKeyNames []string `json:"api_key_names,omitempty"` + ApiKeyUuids []string `json:"api_key_uuids,omitempty"` + CloudProviders []string `json:"cloud_providers,omitempty"` + ClusterName *string `json:"cluster_name,omitempty"` + EnabledProducts []string `json:"enabled_products,omitempty"` + Envs []string `json:"envs,omitempty"` + FirstSeenAt *int64 `json:"first_seen_at,omitempty"` + InstallMethodTool *string `json:"install_method_tool,omitempty"` + NodeCount *int64 `json:"node_count,omitempty"` + NodeCountByStatus map[string]int64 `json:"node_count_by_status,omitempty"` + OperatingSystems []string `json:"operating_systems,omitempty"` + OtelCollectorDistributions []string `json:"otel_collector_distributions,omitempty"` + OtelCollectorVersions []string `json:"otel_collector_versions,omitempty"` + PodCountByState map[string]int64 `json:"pod_count_by_state,omitempty"` + Services []string `json:"services,omitempty"` + Teams []string `json:"teams,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"agent_versions", "api_key_names", "api_key_uuids", "cloud_providers", "cluster_name", "enabled_products", "envs", "first_seen_at", "install_method_tool", "node_count", "node_count_by_status", "operating_systems", "otel_collector_distributions", "otel_collector_versions", "pod_count_by_state", "services", "teams"}) + } else { + return err + } + o.AgentVersions = all.AgentVersions + o.ApiKeyNames = all.ApiKeyNames + o.ApiKeyUuids = all.ApiKeyUuids + o.CloudProviders = all.CloudProviders + o.ClusterName = all.ClusterName + o.EnabledProducts = all.EnabledProducts + o.Envs = all.Envs + o.FirstSeenAt = all.FirstSeenAt + o.InstallMethodTool = all.InstallMethodTool + o.NodeCount = all.NodeCount + o.NodeCountByStatus = all.NodeCountByStatus + o.OperatingSystems = all.OperatingSystems + o.OtelCollectorDistributions = all.OtelCollectorDistributions + o.OtelCollectorVersions = all.OtelCollectorVersions + o.PodCountByState = all.PodCountByState + o.Services = all.Services + o.Teams = all.Teams + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_fleet_clusters_response.go b/api/datadogV2/model_fleet_clusters_response.go new file mode 100644 index 00000000000..89a1fcbd5d3 --- /dev/null +++ b/api/datadogV2/model_fleet_clusters_response.go @@ -0,0 +1,148 @@ +// 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" +) + +// FleetClustersResponse Response containing a paginated list of fleet clusters. +type FleetClustersResponse struct { + // The response data containing status and clusters array. + Data FleetClustersResponseData `json:"data"` + // Metadata for the list of clusters response. + Meta *FleetClustersResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetClustersResponse instantiates a new FleetClustersResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetClustersResponse(data FleetClustersResponseData) *FleetClustersResponse { + this := FleetClustersResponse{} + this.Data = data + return &this +} + +// NewFleetClustersResponseWithDefaults instantiates a new FleetClustersResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetClustersResponseWithDefaults() *FleetClustersResponse { + this := FleetClustersResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *FleetClustersResponse) GetData() FleetClustersResponseData { + if o == nil { + var ret FleetClustersResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *FleetClustersResponse) GetDataOk() (*FleetClustersResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *FleetClustersResponse) SetData(v FleetClustersResponseData) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *FleetClustersResponse) GetMeta() FleetClustersResponseMeta { + if o == nil || o.Meta == nil { + var ret FleetClustersResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClustersResponse) GetMetaOk() (*FleetClustersResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *FleetClustersResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given FleetClustersResponseMeta and assigns it to the Meta field. +func (o *FleetClustersResponse) SetMeta(v FleetClustersResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetClustersResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetClustersResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FleetClustersResponseData `json:"data"` + Meta *FleetClustersResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_fleet_clusters_response_data.go b/api/datadogV2/model_fleet_clusters_response_data.go new file mode 100644 index 00000000000..68156127dc7 --- /dev/null +++ b/api/datadogV2/model_fleet_clusters_response_data.go @@ -0,0 +1,174 @@ +// 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" +) + +// FleetClustersResponseData The response data containing status and clusters array. +type FleetClustersResponseData struct { + // Attributes of the fleet clusters response containing the list of clusters. + Attributes FleetClustersResponseDataAttributes `json:"attributes"` + // Status identifier. + Id string `json:"id"` + // Resource type. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetClustersResponseData instantiates a new FleetClustersResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetClustersResponseData(attributes FleetClustersResponseDataAttributes, id string, typeVar string) *FleetClustersResponseData { + this := FleetClustersResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewFleetClustersResponseDataWithDefaults instantiates a new FleetClustersResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetClustersResponseDataWithDefaults() *FleetClustersResponseData { + this := FleetClustersResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *FleetClustersResponseData) GetAttributes() FleetClustersResponseDataAttributes { + if o == nil { + var ret FleetClustersResponseDataAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *FleetClustersResponseData) GetAttributesOk() (*FleetClustersResponseDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *FleetClustersResponseData) SetAttributes(v FleetClustersResponseDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *FleetClustersResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *FleetClustersResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *FleetClustersResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *FleetClustersResponseData) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *FleetClustersResponseData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FleetClustersResponseData) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetClustersResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetClustersResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FleetClustersResponseDataAttributes `json:"attributes"` + Id *string `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_fleet_clusters_response_data_attributes.go b/api/datadogV2/model_fleet_clusters_response_data_attributes.go new file mode 100644 index 00000000000..0f224f417b8 --- /dev/null +++ b/api/datadogV2/model_fleet_clusters_response_data_attributes.go @@ -0,0 +1,102 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetClustersResponseDataAttributes Attributes of the fleet clusters response containing the list of clusters. +type FleetClustersResponseDataAttributes struct { + // Array of clusters matching the query criteria. + Clusters []FleetClusterAttributes `json:"clusters,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetClustersResponseDataAttributes instantiates a new FleetClustersResponseDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetClustersResponseDataAttributes() *FleetClustersResponseDataAttributes { + this := FleetClustersResponseDataAttributes{} + return &this +} + +// NewFleetClustersResponseDataAttributesWithDefaults instantiates a new FleetClustersResponseDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetClustersResponseDataAttributesWithDefaults() *FleetClustersResponseDataAttributes { + this := FleetClustersResponseDataAttributes{} + return &this +} + +// GetClusters returns the Clusters field value if set, zero value otherwise. +func (o *FleetClustersResponseDataAttributes) GetClusters() []FleetClusterAttributes { + if o == nil || o.Clusters == nil { + var ret []FleetClusterAttributes + return ret + } + return o.Clusters +} + +// GetClustersOk returns a tuple with the Clusters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClustersResponseDataAttributes) GetClustersOk() (*[]FleetClusterAttributes, bool) { + if o == nil || o.Clusters == nil { + return nil, false + } + return &o.Clusters, true +} + +// HasClusters returns a boolean if a field has been set. +func (o *FleetClustersResponseDataAttributes) HasClusters() bool { + return o != nil && o.Clusters != nil +} + +// SetClusters gets a reference to the given []FleetClusterAttributes and assigns it to the Clusters field. +func (o *FleetClustersResponseDataAttributes) SetClusters(v []FleetClusterAttributes) { + o.Clusters = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetClustersResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Clusters != nil { + toSerialize["clusters"] = o.Clusters + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetClustersResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Clusters []FleetClusterAttributes `json:"clusters,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"clusters"}) + } else { + return err + } + o.Clusters = all.Clusters + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_fleet_clusters_response_meta.go b/api/datadogV2/model_fleet_clusters_response_meta.go new file mode 100644 index 00000000000..fb4aca57a51 --- /dev/null +++ b/api/datadogV2/model_fleet_clusters_response_meta.go @@ -0,0 +1,102 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetClustersResponseMeta Metadata for the list of clusters response. +type FleetClustersResponseMeta struct { + // Total number of clusters matching the filter criteria across all pages. + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetClustersResponseMeta instantiates a new FleetClustersResponseMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetClustersResponseMeta() *FleetClustersResponseMeta { + this := FleetClustersResponseMeta{} + return &this +} + +// NewFleetClustersResponseMetaWithDefaults instantiates a new FleetClustersResponseMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetClustersResponseMetaWithDefaults() *FleetClustersResponseMeta { + this := FleetClustersResponseMeta{} + return &this +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *FleetClustersResponseMeta) GetTotalFilteredCount() int64 { + if o == nil || o.TotalFilteredCount == nil { + var ret int64 + return ret + } + return *o.TotalFilteredCount +} + +// GetTotalFilteredCountOk returns a tuple with the TotalFilteredCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetClustersResponseMeta) GetTotalFilteredCountOk() (*int64, bool) { + if o == nil || o.TotalFilteredCount == nil { + return nil, false + } + return o.TotalFilteredCount, true +} + +// HasTotalFilteredCount returns a boolean if a field has been set. +func (o *FleetClustersResponseMeta) HasTotalFilteredCount() bool { + return o != nil && o.TotalFilteredCount != nil +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *FleetClustersResponseMeta) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetClustersResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetClustersResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"total_filtered_count"}) + } else { + return err + } + o.TotalFilteredCount = all.TotalFilteredCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_fleet_instrumented_pod_group_attributes.go b/api/datadogV2/model_fleet_instrumented_pod_group_attributes.go new file mode 100644 index 00000000000..cc8cf0c1f14 --- /dev/null +++ b/api/datadogV2/model_fleet_instrumented_pod_group_attributes.go @@ -0,0 +1,417 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetInstrumentedPodGroupAttributes Attributes of a group of instrumented pods targeted for SSI injection. +type FleetInstrumentedPodGroupAttributes struct { + // The SSI injection target configuration applied to the pod group. + AppliedTarget map[string]interface{} `json:"applied_target,omitempty"` + // The name of the applied SSI injection target. + AppliedTargetName *string `json:"applied_target_name,omitempty"` + // Tags injected into the pods by the Admission Controller. + InjectedTags []string `json:"injected_tags,omitempty"` + // The kind of the Kubernetes owner reference. + KubeOwnerrefKind *string `json:"kube_ownerref_kind,omitempty"` + // The name of the Kubernetes owner reference (deployment, statefulset, etc.). + KubeOwnerrefName *string `json:"kube_ownerref_name,omitempty"` + // Library injection annotations on the pod group. + LibInjectionAnnotations []string `json:"lib_injection_annotations,omitempty"` + // The Kubernetes namespace of the pod group. + Namespace *string `json:"namespace,omitempty"` + // Total number of pods in the group. + PodCount *int64 `json:"pod_count,omitempty"` + // Names of the individual pods in the group. + PodNames []string `json:"pod_names,omitempty"` + // Additional tags associated with the pod group. + Tags map[string]string `json:"tags,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetInstrumentedPodGroupAttributes instantiates a new FleetInstrumentedPodGroupAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetInstrumentedPodGroupAttributes() *FleetInstrumentedPodGroupAttributes { + this := FleetInstrumentedPodGroupAttributes{} + return &this +} + +// NewFleetInstrumentedPodGroupAttributesWithDefaults instantiates a new FleetInstrumentedPodGroupAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetInstrumentedPodGroupAttributesWithDefaults() *FleetInstrumentedPodGroupAttributes { + this := FleetInstrumentedPodGroupAttributes{} + return &this +} + +// GetAppliedTarget returns the AppliedTarget field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetAppliedTarget() map[string]interface{} { + if o == nil || o.AppliedTarget == nil { + var ret map[string]interface{} + return ret + } + return o.AppliedTarget +} + +// GetAppliedTargetOk returns a tuple with the AppliedTarget field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetAppliedTargetOk() (*map[string]interface{}, bool) { + if o == nil || o.AppliedTarget == nil { + return nil, false + } + return &o.AppliedTarget, true +} + +// HasAppliedTarget returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasAppliedTarget() bool { + return o != nil && o.AppliedTarget != nil +} + +// SetAppliedTarget gets a reference to the given map[string]interface{} and assigns it to the AppliedTarget field. +func (o *FleetInstrumentedPodGroupAttributes) SetAppliedTarget(v map[string]interface{}) { + o.AppliedTarget = v +} + +// GetAppliedTargetName returns the AppliedTargetName field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetAppliedTargetName() string { + if o == nil || o.AppliedTargetName == nil { + var ret string + return ret + } + return *o.AppliedTargetName +} + +// GetAppliedTargetNameOk returns a tuple with the AppliedTargetName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetAppliedTargetNameOk() (*string, bool) { + if o == nil || o.AppliedTargetName == nil { + return nil, false + } + return o.AppliedTargetName, true +} + +// HasAppliedTargetName returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasAppliedTargetName() bool { + return o != nil && o.AppliedTargetName != nil +} + +// SetAppliedTargetName gets a reference to the given string and assigns it to the AppliedTargetName field. +func (o *FleetInstrumentedPodGroupAttributes) SetAppliedTargetName(v string) { + o.AppliedTargetName = &v +} + +// GetInjectedTags returns the InjectedTags field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetInjectedTags() []string { + if o == nil || o.InjectedTags == nil { + var ret []string + return ret + } + return o.InjectedTags +} + +// GetInjectedTagsOk returns a tuple with the InjectedTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetInjectedTagsOk() (*[]string, bool) { + if o == nil || o.InjectedTags == nil { + return nil, false + } + return &o.InjectedTags, true +} + +// HasInjectedTags returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasInjectedTags() bool { + return o != nil && o.InjectedTags != nil +} + +// SetInjectedTags gets a reference to the given []string and assigns it to the InjectedTags field. +func (o *FleetInstrumentedPodGroupAttributes) SetInjectedTags(v []string) { + o.InjectedTags = v +} + +// GetKubeOwnerrefKind returns the KubeOwnerrefKind field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetKubeOwnerrefKind() string { + if o == nil || o.KubeOwnerrefKind == nil { + var ret string + return ret + } + return *o.KubeOwnerrefKind +} + +// GetKubeOwnerrefKindOk returns a tuple with the KubeOwnerrefKind field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetKubeOwnerrefKindOk() (*string, bool) { + if o == nil || o.KubeOwnerrefKind == nil { + return nil, false + } + return o.KubeOwnerrefKind, true +} + +// HasKubeOwnerrefKind returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasKubeOwnerrefKind() bool { + return o != nil && o.KubeOwnerrefKind != nil +} + +// SetKubeOwnerrefKind gets a reference to the given string and assigns it to the KubeOwnerrefKind field. +func (o *FleetInstrumentedPodGroupAttributes) SetKubeOwnerrefKind(v string) { + o.KubeOwnerrefKind = &v +} + +// GetKubeOwnerrefName returns the KubeOwnerrefName field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetKubeOwnerrefName() string { + if o == nil || o.KubeOwnerrefName == nil { + var ret string + return ret + } + return *o.KubeOwnerrefName +} + +// GetKubeOwnerrefNameOk returns a tuple with the KubeOwnerrefName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetKubeOwnerrefNameOk() (*string, bool) { + if o == nil || o.KubeOwnerrefName == nil { + return nil, false + } + return o.KubeOwnerrefName, true +} + +// HasKubeOwnerrefName returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasKubeOwnerrefName() bool { + return o != nil && o.KubeOwnerrefName != nil +} + +// SetKubeOwnerrefName gets a reference to the given string and assigns it to the KubeOwnerrefName field. +func (o *FleetInstrumentedPodGroupAttributes) SetKubeOwnerrefName(v string) { + o.KubeOwnerrefName = &v +} + +// GetLibInjectionAnnotations returns the LibInjectionAnnotations field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetLibInjectionAnnotations() []string { + if o == nil || o.LibInjectionAnnotations == nil { + var ret []string + return ret + } + return o.LibInjectionAnnotations +} + +// GetLibInjectionAnnotationsOk returns a tuple with the LibInjectionAnnotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetLibInjectionAnnotationsOk() (*[]string, bool) { + if o == nil || o.LibInjectionAnnotations == nil { + return nil, false + } + return &o.LibInjectionAnnotations, true +} + +// HasLibInjectionAnnotations returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasLibInjectionAnnotations() bool { + return o != nil && o.LibInjectionAnnotations != nil +} + +// SetLibInjectionAnnotations gets a reference to the given []string and assigns it to the LibInjectionAnnotations field. +func (o *FleetInstrumentedPodGroupAttributes) SetLibInjectionAnnotations(v []string) { + o.LibInjectionAnnotations = v +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetNamespace() string { + if o == nil || o.Namespace == nil { + var ret string + return ret + } + return *o.Namespace +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetNamespaceOk() (*string, bool) { + if o == nil || o.Namespace == nil { + return nil, false + } + return o.Namespace, true +} + +// HasNamespace returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasNamespace() bool { + return o != nil && o.Namespace != nil +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *FleetInstrumentedPodGroupAttributes) SetNamespace(v string) { + o.Namespace = &v +} + +// GetPodCount returns the PodCount field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetPodCount() int64 { + if o == nil || o.PodCount == nil { + var ret int64 + return ret + } + return *o.PodCount +} + +// GetPodCountOk returns a tuple with the PodCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetPodCountOk() (*int64, bool) { + if o == nil || o.PodCount == nil { + return nil, false + } + return o.PodCount, true +} + +// HasPodCount returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasPodCount() bool { + return o != nil && o.PodCount != nil +} + +// SetPodCount gets a reference to the given int64 and assigns it to the PodCount field. +func (o *FleetInstrumentedPodGroupAttributes) SetPodCount(v int64) { + o.PodCount = &v +} + +// GetPodNames returns the PodNames field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetPodNames() []string { + if o == nil || o.PodNames == nil { + var ret []string + return ret + } + return o.PodNames +} + +// GetPodNamesOk returns a tuple with the PodNames field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetPodNamesOk() (*[]string, bool) { + if o == nil || o.PodNames == nil { + return nil, false + } + return &o.PodNames, true +} + +// HasPodNames returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasPodNames() bool { + return o != nil && o.PodNames != nil +} + +// SetPodNames gets a reference to the given []string and assigns it to the PodNames field. +func (o *FleetInstrumentedPodGroupAttributes) SetPodNames(v []string) { + o.PodNames = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *FleetInstrumentedPodGroupAttributes) GetTags() map[string]string { + if o == nil || o.Tags == nil { + var ret map[string]string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodGroupAttributes) GetTagsOk() (*map[string]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *FleetInstrumentedPodGroupAttributes) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given map[string]string and assigns it to the Tags field. +func (o *FleetInstrumentedPodGroupAttributes) SetTags(v map[string]string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetInstrumentedPodGroupAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AppliedTarget != nil { + toSerialize["applied_target"] = o.AppliedTarget + } + if o.AppliedTargetName != nil { + toSerialize["applied_target_name"] = o.AppliedTargetName + } + if o.InjectedTags != nil { + toSerialize["injected_tags"] = o.InjectedTags + } + if o.KubeOwnerrefKind != nil { + toSerialize["kube_ownerref_kind"] = o.KubeOwnerrefKind + } + if o.KubeOwnerrefName != nil { + toSerialize["kube_ownerref_name"] = o.KubeOwnerrefName + } + if o.LibInjectionAnnotations != nil { + toSerialize["lib_injection_annotations"] = o.LibInjectionAnnotations + } + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + if o.PodCount != nil { + toSerialize["pod_count"] = o.PodCount + } + if o.PodNames != nil { + toSerialize["pod_names"] = o.PodNames + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetInstrumentedPodGroupAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AppliedTarget map[string]interface{} `json:"applied_target,omitempty"` + AppliedTargetName *string `json:"applied_target_name,omitempty"` + InjectedTags []string `json:"injected_tags,omitempty"` + KubeOwnerrefKind *string `json:"kube_ownerref_kind,omitempty"` + KubeOwnerrefName *string `json:"kube_ownerref_name,omitempty"` + LibInjectionAnnotations []string `json:"lib_injection_annotations,omitempty"` + Namespace *string `json:"namespace,omitempty"` + PodCount *int64 `json:"pod_count,omitempty"` + PodNames []string `json:"pod_names,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"applied_target", "applied_target_name", "injected_tags", "kube_ownerref_kind", "kube_ownerref_name", "lib_injection_annotations", "namespace", "pod_count", "pod_names", "tags"}) + } else { + return err + } + o.AppliedTarget = all.AppliedTarget + o.AppliedTargetName = all.AppliedTargetName + o.InjectedTags = all.InjectedTags + o.KubeOwnerrefKind = all.KubeOwnerrefKind + o.KubeOwnerrefName = all.KubeOwnerrefName + o.LibInjectionAnnotations = all.LibInjectionAnnotations + o.Namespace = all.Namespace + o.PodCount = all.PodCount + o.PodNames = all.PodNames + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_fleet_instrumented_pods_response.go b/api/datadogV2/model_fleet_instrumented_pods_response.go new file mode 100644 index 00000000000..405ffb9bbe7 --- /dev/null +++ b/api/datadogV2/model_fleet_instrumented_pods_response.go @@ -0,0 +1,110 @@ +// 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" +) + +// FleetInstrumentedPodsResponse Response containing instrumented pods for a Kubernetes cluster. +type FleetInstrumentedPodsResponse struct { + // The response data containing the cluster name and instrumented pod groups. + Data FleetInstrumentedPodsResponseData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetInstrumentedPodsResponse instantiates a new FleetInstrumentedPodsResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetInstrumentedPodsResponse(data FleetInstrumentedPodsResponseData) *FleetInstrumentedPodsResponse { + this := FleetInstrumentedPodsResponse{} + this.Data = data + return &this +} + +// NewFleetInstrumentedPodsResponseWithDefaults instantiates a new FleetInstrumentedPodsResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetInstrumentedPodsResponseWithDefaults() *FleetInstrumentedPodsResponse { + this := FleetInstrumentedPodsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *FleetInstrumentedPodsResponse) GetData() FleetInstrumentedPodsResponseData { + if o == nil { + var ret FleetInstrumentedPodsResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodsResponse) GetDataOk() (*FleetInstrumentedPodsResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *FleetInstrumentedPodsResponse) SetData(v FleetInstrumentedPodsResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetInstrumentedPodsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetInstrumentedPodsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FleetInstrumentedPodsResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_fleet_instrumented_pods_response_data.go b/api/datadogV2/model_fleet_instrumented_pods_response_data.go new file mode 100644 index 00000000000..f84fbd3edcb --- /dev/null +++ b/api/datadogV2/model_fleet_instrumented_pods_response_data.go @@ -0,0 +1,174 @@ +// 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" +) + +// FleetInstrumentedPodsResponseData The response data containing the cluster name and instrumented pod groups. +type FleetInstrumentedPodsResponseData struct { + // Attributes of the instrumented pods response containing the list of pod groups. + Attributes FleetInstrumentedPodsResponseDataAttributes `json:"attributes"` + // The cluster name identifier. + Id string `json:"id"` + // Resource type. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetInstrumentedPodsResponseData instantiates a new FleetInstrumentedPodsResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetInstrumentedPodsResponseData(attributes FleetInstrumentedPodsResponseDataAttributes, id string, typeVar string) *FleetInstrumentedPodsResponseData { + this := FleetInstrumentedPodsResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewFleetInstrumentedPodsResponseDataWithDefaults instantiates a new FleetInstrumentedPodsResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetInstrumentedPodsResponseDataWithDefaults() *FleetInstrumentedPodsResponseData { + this := FleetInstrumentedPodsResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *FleetInstrumentedPodsResponseData) GetAttributes() FleetInstrumentedPodsResponseDataAttributes { + if o == nil { + var ret FleetInstrumentedPodsResponseDataAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodsResponseData) GetAttributesOk() (*FleetInstrumentedPodsResponseDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *FleetInstrumentedPodsResponseData) SetAttributes(v FleetInstrumentedPodsResponseDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *FleetInstrumentedPodsResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodsResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *FleetInstrumentedPodsResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *FleetInstrumentedPodsResponseData) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodsResponseData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FleetInstrumentedPodsResponseData) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetInstrumentedPodsResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetInstrumentedPodsResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FleetInstrumentedPodsResponseDataAttributes `json:"attributes"` + Id *string `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_fleet_instrumented_pods_response_data_attributes.go b/api/datadogV2/model_fleet_instrumented_pods_response_data_attributes.go new file mode 100644 index 00000000000..9ee82a5a89d --- /dev/null +++ b/api/datadogV2/model_fleet_instrumented_pods_response_data_attributes.go @@ -0,0 +1,102 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetInstrumentedPodsResponseDataAttributes Attributes of the instrumented pods response containing the list of pod groups. +type FleetInstrumentedPodsResponseDataAttributes struct { + // Array of instrumented pod groups in the cluster. + Groups []FleetInstrumentedPodGroupAttributes `json:"groups,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetInstrumentedPodsResponseDataAttributes instantiates a new FleetInstrumentedPodsResponseDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetInstrumentedPodsResponseDataAttributes() *FleetInstrumentedPodsResponseDataAttributes { + this := FleetInstrumentedPodsResponseDataAttributes{} + return &this +} + +// NewFleetInstrumentedPodsResponseDataAttributesWithDefaults instantiates a new FleetInstrumentedPodsResponseDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetInstrumentedPodsResponseDataAttributesWithDefaults() *FleetInstrumentedPodsResponseDataAttributes { + this := FleetInstrumentedPodsResponseDataAttributes{} + return &this +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *FleetInstrumentedPodsResponseDataAttributes) GetGroups() []FleetInstrumentedPodGroupAttributes { + if o == nil || o.Groups == nil { + var ret []FleetInstrumentedPodGroupAttributes + return ret + } + return o.Groups +} + +// GetGroupsOk returns a tuple with the Groups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetInstrumentedPodsResponseDataAttributes) GetGroupsOk() (*[]FleetInstrumentedPodGroupAttributes, bool) { + if o == nil || o.Groups == nil { + return nil, false + } + return &o.Groups, true +} + +// HasGroups returns a boolean if a field has been set. +func (o *FleetInstrumentedPodsResponseDataAttributes) HasGroups() bool { + return o != nil && o.Groups != nil +} + +// SetGroups gets a reference to the given []FleetInstrumentedPodGroupAttributes and assigns it to the Groups field. +func (o *FleetInstrumentedPodsResponseDataAttributes) SetGroups(v []FleetInstrumentedPodGroupAttributes) { + o.Groups = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetInstrumentedPodsResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetInstrumentedPodsResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Groups []FleetInstrumentedPodGroupAttributes `json:"groups,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"groups"}) + } else { + return err + } + o.Groups = all.Groups + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_fleet_tracer_attributes.go b/api/datadogV2/model_fleet_tracer_attributes.go new file mode 100644 index 00000000000..bc294d346ef --- /dev/null +++ b/api/datadogV2/model_fleet_tracer_attributes.go @@ -0,0 +1,417 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetTracerAttributes Attributes of a fleet tracer representing a service instance reporting telemetry. +type FleetTracerAttributes struct { + // The environment the tracer is reporting from. + Env *string `json:"env,omitempty"` + // The hostname where the tracer is running. + Hostname *string `json:"hostname,omitempty"` + // The programming language of the traced application. + Language *string `json:"language,omitempty"` + // The version of the programming language runtime. + LanguageVersion *string `json:"language_version,omitempty"` + // The remote configuration status of the tracer. + RemoteConfigStatus *string `json:"remote_config_status,omitempty"` + // Runtime identifiers for the tracer instances. + RuntimeIds []string `json:"runtime_ids,omitempty"` + // The telemetry-derived service name reported by the tracer. + Service *string `json:"service,omitempty"` + // The service hostname reported by the tracer. + ServiceHostname *string `json:"service_hostname,omitempty"` + // The version of the traced service. + ServiceVersion *string `json:"service_version,omitempty"` + // The version of the Datadog tracer library. + TracerVersion *string `json:"tracer_version,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetTracerAttributes instantiates a new FleetTracerAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetTracerAttributes() *FleetTracerAttributes { + this := FleetTracerAttributes{} + return &this +} + +// NewFleetTracerAttributesWithDefaults instantiates a new FleetTracerAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetTracerAttributesWithDefaults() *FleetTracerAttributes { + this := FleetTracerAttributes{} + return &this +} + +// GetEnv returns the Env field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetEnv() string { + if o == nil || o.Env == nil { + var ret string + return ret + } + return *o.Env +} + +// GetEnvOk returns a tuple with the Env field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetEnvOk() (*string, bool) { + if o == nil || o.Env == nil { + return nil, false + } + return o.Env, true +} + +// HasEnv returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasEnv() bool { + return o != nil && o.Env != nil +} + +// SetEnv gets a reference to the given string and assigns it to the Env field. +func (o *FleetTracerAttributes) SetEnv(v string) { + o.Env = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetHostname() string { + if o == nil || o.Hostname == nil { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetHostnameOk() (*string, bool) { + if o == nil || o.Hostname == nil { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasHostname() bool { + return o != nil && o.Hostname != nil +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *FleetTracerAttributes) SetHostname(v string) { + o.Hostname = &v +} + +// GetLanguage returns the Language field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetLanguage() string { + if o == nil || o.Language == nil { + var ret string + return ret + } + return *o.Language +} + +// GetLanguageOk returns a tuple with the Language field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetLanguageOk() (*string, bool) { + if o == nil || o.Language == nil { + return nil, false + } + return o.Language, true +} + +// HasLanguage returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasLanguage() bool { + return o != nil && o.Language != nil +} + +// SetLanguage gets a reference to the given string and assigns it to the Language field. +func (o *FleetTracerAttributes) SetLanguage(v string) { + o.Language = &v +} + +// GetLanguageVersion returns the LanguageVersion field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetLanguageVersion() string { + if o == nil || o.LanguageVersion == nil { + var ret string + return ret + } + return *o.LanguageVersion +} + +// GetLanguageVersionOk returns a tuple with the LanguageVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetLanguageVersionOk() (*string, bool) { + if o == nil || o.LanguageVersion == nil { + return nil, false + } + return o.LanguageVersion, true +} + +// HasLanguageVersion returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasLanguageVersion() bool { + return o != nil && o.LanguageVersion != nil +} + +// SetLanguageVersion gets a reference to the given string and assigns it to the LanguageVersion field. +func (o *FleetTracerAttributes) SetLanguageVersion(v string) { + o.LanguageVersion = &v +} + +// GetRemoteConfigStatus returns the RemoteConfigStatus field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetRemoteConfigStatus() string { + if o == nil || o.RemoteConfigStatus == nil { + var ret string + return ret + } + return *o.RemoteConfigStatus +} + +// GetRemoteConfigStatusOk returns a tuple with the RemoteConfigStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetRemoteConfigStatusOk() (*string, bool) { + if o == nil || o.RemoteConfigStatus == nil { + return nil, false + } + return o.RemoteConfigStatus, true +} + +// HasRemoteConfigStatus returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasRemoteConfigStatus() bool { + return o != nil && o.RemoteConfigStatus != nil +} + +// SetRemoteConfigStatus gets a reference to the given string and assigns it to the RemoteConfigStatus field. +func (o *FleetTracerAttributes) SetRemoteConfigStatus(v string) { + o.RemoteConfigStatus = &v +} + +// GetRuntimeIds returns the RuntimeIds field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetRuntimeIds() []string { + if o == nil || o.RuntimeIds == nil { + var ret []string + return ret + } + return o.RuntimeIds +} + +// GetRuntimeIdsOk returns a tuple with the RuntimeIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetRuntimeIdsOk() (*[]string, bool) { + if o == nil || o.RuntimeIds == nil { + return nil, false + } + return &o.RuntimeIds, true +} + +// HasRuntimeIds returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasRuntimeIds() bool { + return o != nil && o.RuntimeIds != nil +} + +// SetRuntimeIds gets a reference to the given []string and assigns it to the RuntimeIds field. +func (o *FleetTracerAttributes) SetRuntimeIds(v []string) { + o.RuntimeIds = v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetService() string { + if o == nil || o.Service == nil { + var ret string + return ret + } + return *o.Service +} + +// GetServiceOk returns a tuple with the Service field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetServiceOk() (*string, bool) { + if o == nil || o.Service == nil { + return nil, false + } + return o.Service, true +} + +// HasService returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasService() bool { + return o != nil && o.Service != nil +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *FleetTracerAttributes) SetService(v string) { + o.Service = &v +} + +// GetServiceHostname returns the ServiceHostname field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetServiceHostname() string { + if o == nil || o.ServiceHostname == nil { + var ret string + return ret + } + return *o.ServiceHostname +} + +// GetServiceHostnameOk returns a tuple with the ServiceHostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetServiceHostnameOk() (*string, bool) { + if o == nil || o.ServiceHostname == nil { + return nil, false + } + return o.ServiceHostname, true +} + +// HasServiceHostname returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasServiceHostname() bool { + return o != nil && o.ServiceHostname != nil +} + +// SetServiceHostname gets a reference to the given string and assigns it to the ServiceHostname field. +func (o *FleetTracerAttributes) SetServiceHostname(v string) { + o.ServiceHostname = &v +} + +// GetServiceVersion returns the ServiceVersion field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetServiceVersion() string { + if o == nil || o.ServiceVersion == nil { + var ret string + return ret + } + return *o.ServiceVersion +} + +// GetServiceVersionOk returns a tuple with the ServiceVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetServiceVersionOk() (*string, bool) { + if o == nil || o.ServiceVersion == nil { + return nil, false + } + return o.ServiceVersion, true +} + +// HasServiceVersion returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasServiceVersion() bool { + return o != nil && o.ServiceVersion != nil +} + +// SetServiceVersion gets a reference to the given string and assigns it to the ServiceVersion field. +func (o *FleetTracerAttributes) SetServiceVersion(v string) { + o.ServiceVersion = &v +} + +// GetTracerVersion returns the TracerVersion field value if set, zero value otherwise. +func (o *FleetTracerAttributes) GetTracerVersion() string { + if o == nil || o.TracerVersion == nil { + var ret string + return ret + } + return *o.TracerVersion +} + +// GetTracerVersionOk returns a tuple with the TracerVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracerAttributes) GetTracerVersionOk() (*string, bool) { + if o == nil || o.TracerVersion == nil { + return nil, false + } + return o.TracerVersion, true +} + +// HasTracerVersion returns a boolean if a field has been set. +func (o *FleetTracerAttributes) HasTracerVersion() bool { + return o != nil && o.TracerVersion != nil +} + +// SetTracerVersion gets a reference to the given string and assigns it to the TracerVersion field. +func (o *FleetTracerAttributes) SetTracerVersion(v string) { + o.TracerVersion = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetTracerAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Env != nil { + toSerialize["env"] = o.Env + } + if o.Hostname != nil { + toSerialize["hostname"] = o.Hostname + } + if o.Language != nil { + toSerialize["language"] = o.Language + } + if o.LanguageVersion != nil { + toSerialize["language_version"] = o.LanguageVersion + } + if o.RemoteConfigStatus != nil { + toSerialize["remote_config_status"] = o.RemoteConfigStatus + } + if o.RuntimeIds != nil { + toSerialize["runtime_ids"] = o.RuntimeIds + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.ServiceHostname != nil { + toSerialize["service_hostname"] = o.ServiceHostname + } + if o.ServiceVersion != nil { + toSerialize["service_version"] = o.ServiceVersion + } + if o.TracerVersion != nil { + toSerialize["tracer_version"] = o.TracerVersion + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetTracerAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Env *string `json:"env,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Language *string `json:"language,omitempty"` + LanguageVersion *string `json:"language_version,omitempty"` + RemoteConfigStatus *string `json:"remote_config_status,omitempty"` + RuntimeIds []string `json:"runtime_ids,omitempty"` + Service *string `json:"service,omitempty"` + ServiceHostname *string `json:"service_hostname,omitempty"` + ServiceVersion *string `json:"service_version,omitempty"` + TracerVersion *string `json:"tracer_version,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"env", "hostname", "language", "language_version", "remote_config_status", "runtime_ids", "service", "service_hostname", "service_version", "tracer_version"}) + } else { + return err + } + o.Env = all.Env + o.Hostname = all.Hostname + o.Language = all.Language + o.LanguageVersion = all.LanguageVersion + o.RemoteConfigStatus = all.RemoteConfigStatus + o.RuntimeIds = all.RuntimeIds + o.Service = all.Service + o.ServiceHostname = all.ServiceHostname + o.ServiceVersion = all.ServiceVersion + o.TracerVersion = all.TracerVersion + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_fleet_tracers_response.go b/api/datadogV2/model_fleet_tracers_response.go new file mode 100644 index 00000000000..2e1bb3f4a51 --- /dev/null +++ b/api/datadogV2/model_fleet_tracers_response.go @@ -0,0 +1,148 @@ +// 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" +) + +// FleetTracersResponse Response containing a paginated list of fleet tracers. +type FleetTracersResponse struct { + // The response data containing status and tracers array. + Data FleetTracersResponseData `json:"data"` + // Metadata for the list of tracers response. + Meta *FleetTracersResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetTracersResponse instantiates a new FleetTracersResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetTracersResponse(data FleetTracersResponseData) *FleetTracersResponse { + this := FleetTracersResponse{} + this.Data = data + return &this +} + +// NewFleetTracersResponseWithDefaults instantiates a new FleetTracersResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetTracersResponseWithDefaults() *FleetTracersResponse { + this := FleetTracersResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *FleetTracersResponse) GetData() FleetTracersResponseData { + if o == nil { + var ret FleetTracersResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *FleetTracersResponse) GetDataOk() (*FleetTracersResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *FleetTracersResponse) SetData(v FleetTracersResponseData) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *FleetTracersResponse) GetMeta() FleetTracersResponseMeta { + if o == nil || o.Meta == nil { + var ret FleetTracersResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracersResponse) GetMetaOk() (*FleetTracersResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *FleetTracersResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given FleetTracersResponseMeta and assigns it to the Meta field. +func (o *FleetTracersResponse) SetMeta(v FleetTracersResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetTracersResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetTracersResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FleetTracersResponseData `json:"data"` + Meta *FleetTracersResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_fleet_tracers_response_data.go b/api/datadogV2/model_fleet_tracers_response_data.go new file mode 100644 index 00000000000..769ac28db6e --- /dev/null +++ b/api/datadogV2/model_fleet_tracers_response_data.go @@ -0,0 +1,174 @@ +// 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" +) + +// FleetTracersResponseData The response data containing status and tracers array. +type FleetTracersResponseData struct { + // Attributes of the fleet tracers response containing the list of tracers. + Attributes FleetTracersResponseDataAttributes `json:"attributes"` + // Status identifier. + Id string `json:"id"` + // Resource type. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetTracersResponseData instantiates a new FleetTracersResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetTracersResponseData(attributes FleetTracersResponseDataAttributes, id string, typeVar string) *FleetTracersResponseData { + this := FleetTracersResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewFleetTracersResponseDataWithDefaults instantiates a new FleetTracersResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetTracersResponseDataWithDefaults() *FleetTracersResponseData { + this := FleetTracersResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *FleetTracersResponseData) GetAttributes() FleetTracersResponseDataAttributes { + if o == nil { + var ret FleetTracersResponseDataAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *FleetTracersResponseData) GetAttributesOk() (*FleetTracersResponseDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *FleetTracersResponseData) SetAttributes(v FleetTracersResponseDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *FleetTracersResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *FleetTracersResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *FleetTracersResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *FleetTracersResponseData) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *FleetTracersResponseData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FleetTracersResponseData) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetTracersResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetTracersResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FleetTracersResponseDataAttributes `json:"attributes"` + Id *string `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_fleet_tracers_response_data_attributes.go b/api/datadogV2/model_fleet_tracers_response_data_attributes.go new file mode 100644 index 00000000000..34bca96ce6b --- /dev/null +++ b/api/datadogV2/model_fleet_tracers_response_data_attributes.go @@ -0,0 +1,102 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetTracersResponseDataAttributes Attributes of the fleet tracers response containing the list of tracers. +type FleetTracersResponseDataAttributes struct { + // Array of tracers matching the query criteria. + Tracers []FleetTracerAttributes `json:"tracers,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetTracersResponseDataAttributes instantiates a new FleetTracersResponseDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetTracersResponseDataAttributes() *FleetTracersResponseDataAttributes { + this := FleetTracersResponseDataAttributes{} + return &this +} + +// NewFleetTracersResponseDataAttributesWithDefaults instantiates a new FleetTracersResponseDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetTracersResponseDataAttributesWithDefaults() *FleetTracersResponseDataAttributes { + this := FleetTracersResponseDataAttributes{} + return &this +} + +// GetTracers returns the Tracers field value if set, zero value otherwise. +func (o *FleetTracersResponseDataAttributes) GetTracers() []FleetTracerAttributes { + if o == nil || o.Tracers == nil { + var ret []FleetTracerAttributes + return ret + } + return o.Tracers +} + +// GetTracersOk returns a tuple with the Tracers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracersResponseDataAttributes) GetTracersOk() (*[]FleetTracerAttributes, bool) { + if o == nil || o.Tracers == nil { + return nil, false + } + return &o.Tracers, true +} + +// HasTracers returns a boolean if a field has been set. +func (o *FleetTracersResponseDataAttributes) HasTracers() bool { + return o != nil && o.Tracers != nil +} + +// SetTracers gets a reference to the given []FleetTracerAttributes and assigns it to the Tracers field. +func (o *FleetTracersResponseDataAttributes) SetTracers(v []FleetTracerAttributes) { + o.Tracers = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetTracersResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Tracers != nil { + toSerialize["tracers"] = o.Tracers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetTracersResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Tracers []FleetTracerAttributes `json:"tracers,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"tracers"}) + } else { + return err + } + o.Tracers = all.Tracers + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_fleet_tracers_response_meta.go b/api/datadogV2/model_fleet_tracers_response_meta.go new file mode 100644 index 00000000000..dd1a57fbb0b --- /dev/null +++ b/api/datadogV2/model_fleet_tracers_response_meta.go @@ -0,0 +1,102 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FleetTracersResponseMeta Metadata for the list of tracers response. +type FleetTracersResponseMeta struct { + // Total number of tracers matching the filter criteria across all pages. + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFleetTracersResponseMeta instantiates a new FleetTracersResponseMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFleetTracersResponseMeta() *FleetTracersResponseMeta { + this := FleetTracersResponseMeta{} + return &this +} + +// NewFleetTracersResponseMetaWithDefaults instantiates a new FleetTracersResponseMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFleetTracersResponseMetaWithDefaults() *FleetTracersResponseMeta { + this := FleetTracersResponseMeta{} + return &this +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *FleetTracersResponseMeta) GetTotalFilteredCount() int64 { + if o == nil || o.TotalFilteredCount == nil { + var ret int64 + return ret + } + return *o.TotalFilteredCount +} + +// GetTotalFilteredCountOk returns a tuple with the TotalFilteredCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FleetTracersResponseMeta) GetTotalFilteredCountOk() (*int64, bool) { + if o == nil || o.TotalFilteredCount == nil { + return nil, false + } + return o.TotalFilteredCount, true +} + +// HasTotalFilteredCount returns a boolean if a field has been set. +func (o *FleetTracersResponseMeta) HasTotalFilteredCount() bool { + return o != nil && o.TotalFilteredCount != nil +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *FleetTracersResponseMeta) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FleetTracersResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FleetTracersResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"total_filtered_count"}) + } else { + return err + } + o.TotalFilteredCount = all.TotalFilteredCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/fleet-automation/ListFleetAgentTracers.go b/examples/v2/fleet-automation/ListFleetAgentTracers.go new file mode 100644 index 00000000000..1292b290ad5 --- /dev/null +++ b/examples/v2/fleet-automation/ListFleetAgentTracers.go @@ -0,0 +1,30 @@ +// List tracers for a specific agent returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListFleetAgentTracers", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewFleetAutomationApi(apiClient) + resp, r, err := api.ListFleetAgentTracers(ctx, "agent_key", *datadogV2.NewListFleetAgentTracersOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FleetAutomationApi.ListFleetAgentTracers`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `FleetAutomationApi.ListFleetAgentTracers`:\n%s\n", responseContent) +} diff --git a/examples/v2/fleet-automation/ListFleetClusters.go b/examples/v2/fleet-automation/ListFleetClusters.go new file mode 100644 index 00000000000..8212f4dcb56 --- /dev/null +++ b/examples/v2/fleet-automation/ListFleetClusters.go @@ -0,0 +1,30 @@ +// List all fleet clusters returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListFleetClusters", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewFleetAutomationApi(apiClient) + resp, r, err := api.ListFleetClusters(ctx, *datadogV2.NewListFleetClustersOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FleetAutomationApi.ListFleetClusters`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `FleetAutomationApi.ListFleetClusters`:\n%s\n", responseContent) +} diff --git a/examples/v2/fleet-automation/ListFleetInstrumentedPods.go b/examples/v2/fleet-automation/ListFleetInstrumentedPods.go new file mode 100644 index 00000000000..5769a2d83dd --- /dev/null +++ b/examples/v2/fleet-automation/ListFleetInstrumentedPods.go @@ -0,0 +1,30 @@ +// List instrumented pods for a cluster returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListFleetInstrumentedPods", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewFleetAutomationApi(apiClient) + resp, r, err := api.ListFleetInstrumentedPods(ctx, "cluster_name") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FleetAutomationApi.ListFleetInstrumentedPods`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `FleetAutomationApi.ListFleetInstrumentedPods`:\n%s\n", responseContent) +} diff --git a/examples/v2/fleet-automation/ListFleetTracers.go b/examples/v2/fleet-automation/ListFleetTracers.go new file mode 100644 index 00000000000..f7ccc17aa3d --- /dev/null +++ b/examples/v2/fleet-automation/ListFleetTracers.go @@ -0,0 +1,30 @@ +// List all fleet tracers returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListFleetTracers", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewFleetAutomationApi(apiClient) + resp, r, err := api.ListFleetTracers(ctx, *datadogV2.NewListFleetTracersOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FleetAutomationApi.ListFleetTracers`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `FleetAutomationApi.ListFleetTracers`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/fleet_automation.feature b/tests/scenarios/features/v2/fleet_automation.feature index b21fe22c60f..3cc13c4aca3 100644 --- a/tests/scenarios/features/v2/fleet_automation.feature +++ b/tests/scenarios/features/v2/fleet_automation.feature @@ -232,6 +232,48 @@ Feature: Fleet Automation When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/fleet-automation + Scenario: List all fleet clusters returns "Bad Request" response + Given operation "ListFleetClusters" enabled + And new "ListFleetClusters" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all fleet clusters returns "Not Found" response + Given operation "ListFleetClusters" enabled + And new "ListFleetClusters" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all fleet clusters returns "OK" response + Given operation "ListFleetClusters" enabled + And new "ListFleetClusters" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all fleet tracers returns "Bad Request" response + Given operation "ListFleetTracers" enabled + And new "ListFleetTracers" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all fleet tracers returns "Not Found" response + Given operation "ListFleetTracers" enabled + And new "ListFleetTracers" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all fleet tracers returns "OK" response + Given operation "ListFleetTracers" enabled + And new "ListFleetTracers" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/fleet-automation Scenario: List all schedules returns "Bad Request" response Given operation "ListFleetSchedules" enabled @@ -246,6 +288,54 @@ Feature: Fleet Automation When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/fleet-automation + Scenario: List instrumented pods for a cluster returns "Bad Request" response + Given operation "ListFleetInstrumentedPods" enabled + And new "ListFleetInstrumentedPods" request + And request contains "cluster_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: List instrumented pods for a cluster returns "Not Found" response + Given operation "ListFleetInstrumentedPods" enabled + And new "ListFleetInstrumentedPods" request + And request contains "cluster_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: List instrumented pods for a cluster returns "OK" response + Given operation "ListFleetInstrumentedPods" enabled + And new "ListFleetInstrumentedPods" request + And request contains "cluster_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/fleet-automation + Scenario: List tracers for a specific agent returns "Bad Request" response + Given operation "ListFleetAgentTracers" enabled + And new "ListFleetAgentTracers" request + And request contains "agent_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: List tracers for a specific agent returns "Not Found" response + Given operation "ListFleetAgentTracers" enabled + And new "ListFleetAgentTracers" request + And request contains "agent_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: List tracers for a specific agent returns "OK" response + Given operation "ListFleetAgentTracers" enabled + And new "ListFleetAgentTracers" request + And request contains "agent_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/fleet-automation Scenario: Trigger a schedule deployment returns "Bad Request" response Given operation "TriggerFleetSchedule" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index bb84d5c5e03..02b5c2d4c59 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -17,6 +17,24 @@ "type": "safe" } }, + "ListFleetAgentTracers": { + "tag": "Fleet Automation", + "undo": { + "type": "safe" + } + }, + "ListFleetClusters": { + "tag": "Fleet Automation", + "undo": { + "type": "safe" + } + }, + "ListFleetInstrumentedPods": { + "tag": "Fleet Automation", + "undo": { + "type": "safe" + } + }, "ListFleetDeployments": { "tag": "Fleet Automation", "undo": { @@ -111,6 +129,12 @@ "type": "unsafe" } }, + "ListFleetTracers": { + "tag": "Fleet Automation", + "undo": { + "type": "safe" + } + }, "ListDatastores": { "tag": "Actions Datastores", "undo": {